-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No test found in a WinUI 3 Unit Test App #423
Comments
I don't have any experience with WinUI 3. Have you done the list of steps illustrated here? https://learn.microsoft.com/windows/apps/winui/winui3/testing/#how-do-i-test-non-winui-functionality-in-my-app |
I'm was having the same issue in a ASP.NET MVC 8 project. The test is visible in Test Explorer, but they don't run when I start them from Visual Studio interface. Running through I've tried all the solutions I could find on the internet, no luck. My <!-- BAD version -->
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.10" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.TestPlatform" Version="17.11.1" />
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="17.11.1" />
<PackageReference Include="MSTest" Version="3.6.1" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.12.6" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> When I replaced that <!-- GOOD version -->
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> I'm not sure which package specifically fixed the issue. @bradwilson, if you know, it would be great to add some error message to the console when this issue happens, or at least some mention in the README section on GitHub. Would have saved me couple hours. Thanks! |
I don't even know what's wrong yet. I haven't seen a repro project, only partial .csproj files. 😉 |
Here is a repro project based on the Unit Test App (WinUI 3 in Desktop) project template: Here's what I noticed:
Thanks for your help! |
@JulienTheron I'm sorry, I don't know anything about how WinUI is supposed to work with VSTest. You're going to have to get the VSTest team and/or the WinUI team and/or the Test Explorer involved here. That fact that things work with It's also possible that WinUI just doesn't work with xUnit.net. It's not a supported scenario. I will work to fix the issue once one the problem has been identified (assuming it's possible), but I am personally incapable of identifying what the problem is. Someone else is going to need to figure that out, I'm afraid. |
@PeterDraex I am not able to reproduce your problem, so please open a new issue for your specific problem (with a repro project). In the meantime, here is what I got from basically just creating and empty MVC project + an xUnit.net project, testing with I will note that your original package list includes several things that could cause failures, starting with the fact that you appear to be trying to mix MSTest and xUnit.net into the same project. |
Hi there,
We're currently porting a UWP app to WinUI 3, and we wanted to port the xUnit tests as well.
Creating a standard xUnit test project can discover and run the tests, but some of them fails because we're using APIs that that require package identity.
Since there is no template for creating a xUnit-specific WinUI 3 Test App, I used the MSTest one and edited the referenced packages as follows:
The projects builds without errors, and I can see the tests in Visual Studio's Test Explorer, but they do not run as they're not discovered at runtime:
Test discovery finished: 0 Tests found in 1,2 sec
Is this a known issue?
Thanks in advance.
The text was updated successfully, but these errors were encountered: