You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
create App project from winui3 template
create AppTest project from winui3 unit testing template
add DependencyObjectSelector.cs to App (which doesn't depend on anything so it's just a simple copy/paste and change namespace)
add DependencyObjectSelectorTest.cs to AppTest, and accept the suggestion to add a project reference to App
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
Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point.
add <StartupObject>AppTest.Program</StartupObject> (which is the XAML generated main from winui 3)
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.
The text was updated successfully, but these errors were encountered:
We need a separate project for testing UI-related code from the App project. We currently have
Tests.App
but we probably should addTests.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:
App
project from winui3 templateAppTest
project from winui3 unit testing templateDependencyObjectSelector.cs
toApp
(which doesn't depend on anything so it's just a simple copy/paste and change namespace)DependencyObjectSelectorTest.cs
toAppTest
, and accept the suggestion to add a project reference toApp
Microsoft.NET.Test.Sdk
click the green test run icon
Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point.
<StartupObject>AppTest.Program</StartupObject>
(which is the XAML generated main from winui 3)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 anAssemblyInitializer
, and it gets a bit further but I run into XAML loading issues.The text was updated successfully, but these errors were encountered: