问题
I'm using VS 2017 with the new csproj in a .NET Standard class library, trying to test the library with a .NET Core 1.1 test project using MSTest testing framework with the dotnet test command. Running locally works perfectly fine; when I send the build to continuous integration, I get the error:
No test discoverer is registered to perform discovery of test cases.
How do I get this discoverer registered, and my tests running, in VSTS?
回答1:
This is my build process on VSTS (detailed on my blog here)
- Add a
dotnet restoretask. - Then a
dotnet buildtask. - Add a
dotnet testtask with the arguments--no-build --logger "trx;LogFileName=tests-log.trx - Add a
Publish test resultstask with the following settings
Test Result Format= VSTestTest Result Files= **/tests-log.trxMerge Test Results= (checked)- In
Control OptionssetRun this taskto run even if a previous task has failed
回答2:
Refer to these steps below:
- Create a new .Net Core test project with MSTest testing framework, there are MSTest.TestAdapter and MSTest.TestFramework package references, which is importance
- Add .NET Core (Preview) step (Command: restore)
- Add .NET Core (Preview) step (Command: build)
- Add .NET Core (Preview) step (Command: test)
- Queue build with Hosted VS2017 build agent.
来源:https://stackoverflow.com/questions/43528526/dotnet-test-on-net-core-1-1-in-vsts-no-test-discoverer-is-registered