Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dotnet test on .NET Core 1.1 in VSTS: No Test Discoverer is Registered

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?

like image 669
Dagrooms Avatar asked Apr 20 '17 19:04

Dagrooms


People also ask

How do I run a test in .NET core?

Let us now click on Run All button in Test Explorer. It will first build the code and the run the test and you will see the total time taken by the test. Let us change the test method so that we can see the output when the test fails. Let us execute the test again by clicking on the Run All button link.

Which of the following .NET core CLI commands would be used to execute all unit tests for a given project?

The dotnet test command is used to execute unit tests in a given solution.

Does dotnet test run in parallel?

Luckily, dotnet test using xUnit V2 runs the tests inside of a project (or even inside a solution) in parallel by default. So at least the tests inside of a project will be started in parallel.

What is dotnet command?

The dotnet command has two functions: It provides commands for working with . NET projects. For example, dotnet build builds a project. Each command defines its own options and arguments.


1 Answers

This is my build process on VSTS (detailed on my blog here)

  1. Add a dotnet restore task.
  2. Then a dotnet build task.
  3. Add a dotnet test task with the arguments --no-build --logger "trx;LogFileName=tests-log.trx
  4. Add a Publish test results task with the following settings

enter image description here

  1. Test Result Format = VSTest
  2. Test Result Files = **/tests-log.trx
  3. Merge Test Results = (checked)
  4. In Control Options set Run this task to run even if a previous task has failed
like image 170
Peter Morris Avatar answered Oct 19 '22 21:10

Peter Morris