microsoft / testfx

MSTest framework and adapter
MIT License
752 stars 255 forks source link

WinUI3 + MSTest #708

Closed azchohfi closed 3 years ago

azchohfi commented 4 years ago

Description

Today, UWP applications are based on .Net Native. Soon, UWP applications will also be able to use .Net Core 5 (https://github.com/dotnet/runtime/issues/35318). This is a great evolution of the platform, but at the same time, requires a few changes to existing libraries, such as MSTest.

If a WinUI3 project references MSTest, instead of using the uap10.0 assemblies (which now should be deprecated), it will use the netstandard1.0 ones, which does not encapsulate the Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer namespace (which contains the very useful UITestMethodAttribute), and creates a Main method, which conflicts with WinUI3's. Also, the current implementation of UITestMethodAttribute uses CoreDispatcher, not the DispatcherQueue, which is preferred, as CoreDispatcher will not work on Win32.

Steps to reproduce

Use WinUI3 and MSTest on the same sdk style .Net Core 5 project

Expected behavior

MSTest works with WinUI3 (both inside and outside of a container - UWA or Win32), providing a UITestMethodAttribute and properly running tests both thru appxrecipe or a simple .Net Core 5 exe.

Actual behavior

Project does not build, and impossible to run the tests

stevenbrix commented 4 years ago

Oh hey, I came here exactly for this :)

azchohfi commented 3 years ago

Related PRs: https://github.com/microsoft/testfx/pull/782 https://github.com/microsoft/testfx/pull/813

Still working on it!

Haplois commented 3 years ago

Related https://github.com/microsoft/vstest/pull/2852 merged. I will update the TP version used in this repo after the completion of the signed build.

Haplois commented 3 years ago

This is included in our latest preview bits.

Haplois commented 3 years ago

This is shipped with Microsoft.NET.Test.Sdk v16.10.0 and MSTest v2.2.4**.

mikeKuester commented 2 years ago

You break MSTest / WPF with that, but no one is interested in that for 10 month now? 👎

https://github.com/microsoft/testfx/issues/851