-
Notifications
You must be signed in to change notification settings - Fork 261
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
"The test framework adapter has not been registered" for simple Testing.Platform example #4267
Comments
Please have a look here https://learn.microsoft.com/dotnet/core/testing/unit-testing-mstest-runner-intro#enable-mstest-runner-in-an-mstest-project. You are missing the Plattest.csproj: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnableMSTestRunner>true</EnableMSTestRunner>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MSTest" />
</ItemGroup>
</Project> Directory.Packages.props: <Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="MSTest" Version="3.6.4" />
</ItemGroup>
</Project> |
Thank you! That works. I think I didn't notice that because it was in the MSTest rather than the Testing Platform part of the content hierarchy. One follow up question: is this mechanism compatible with AOT? If I add I'm partly interested in this because we have a lot of code we would like to move to compile as AOT. I would like to unit test that everything works as expected in that mode. Thanks again. |
For native aot, you will need to switch the nuget packages to use, see here https://github.com/microsoft/testfx/tree/main/samples%2Fpublic%2Fmstest-runner%2FNativeAotRunner. Note that at the moment, we have only really partial support (test methods and parametrized tests but no fixture or other attribute and feature). If you could +1 on the issue for native aot support that would help us with convincing management on prioritizing this work. Note 2, I'd strongly recommend the usage of MSTest.Sdk https://learn.microsoft.com/dotnet/core/testing/unit-testing-mstest-sdk as it would simplify your project setup and would automatically switch the packages based on PublishAot being true or false. |
I am trying out the
Microsoft.Testing.Platform
functionality. From the Note in the overview docs, it sounds like for simple cases I should not need to explicitly create a Main() function or do any setup in it. Everything compiles OK, but when I run the test executable I getI think there is something I need to add to my .csproj but I'm not clear what it is. It might be helpful to have a sample project that doesn't do any explicit setup.
Plattest.csproj:
Directory.Packages.props:
Tests.cs:
The text was updated successfully, but these errors were encountered: