coder / coder/coder-desktop-windows
Add App UI testing project
- Dominant language
- C#
- Stars
- 26
- Forks
- 12
- Avg merge
- 6h 50m
- Merged PRs (30d)
- 1
Description
We need a separate project for testing UI-related code from the App project. We currently have `Tests.App` but we probably should add `Tests.App.UI` as a separate project.
Test code needs to be launched on a UI thread inside of a window's DispatchQueue.
I've tried doing the following in a new solution to see how feasible it is to do, but have run into issue after issue:
1. create `App` project from winui3 template
1. create `AppTest` project from winui3 unit testing template
1. add `DependencyObjectSelector.cs` to `App` (which doesn't depend on anything so it's just a simple copy/paste and change namespace)
1. add `DependencyObjectSelectorTest.cs` to `AppTest`, and accept the suggestion to add a project reference to `App`
1. click the greyed out test run icon beside the test method, accept the prompt to install `Microsoft.NET.Test.Sdk`
click the green test run icon
1. `Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point.`
1. add `AppTest.Program` (which is the XAML generated main from winui 3)
1. `An unhandled exception was thrown by the 'Execute' method. Please report this error to the author of the attribute 'Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer.UITestMethodAttribute'.`
I've also tried using the entry point from `Microsoft.NET.Test.Sdk` (which is empty) and doing winui 3 startup in an `AssemblyInitializer`, and it gets a bit further but I run into XAML loading issues.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by comparing the existing Tests.App project with the proposed Tests.App.UI project, then reproduce the DependencyObjectSelectorTest.cs setup described in the issue. Read the WinUI 3 template setup and the Microsoft.NET.Test.Sdk and UITestMethodAttribute errors first. Done means a separate UI test project can launch tests on the UI thread inside a window DispatchQueue without the reported entry-point or XAML-loading failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop, testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100