You can execute your unit tests with or without collecting coverage information by running one of the VSTest built-in configurations. VSTest is an execution engine that can execute NUnit, MSTest, and xUnit tests. As a result,  it allows you to execute tests from projects that use different testing frameworks in a single run. For example, if your Visual Studio solution contains two projects that use two different testing frameworks, NUnit and MSTest, you can run the tests in both projects in one run.

VSTest uses framework-specific test adapters to find and execute tests. If the tested scope includes multiple projects that use the same testing framework, ensure that the version of the adapter for this framework is consistent across all the projects.

Run one of the following built-in test configurations on the scope of analysis to execute your tests with VSTest:

  • Run VSTest Tests - executes unit tests in the tested scope
  • Run VSTest Tests with Coverage - executes unit tests in the tested scope, and collects coverage information

See Configuring Test Configurations for details about specifying a test configuration.

Running MSTest Tests with VSTest

  • To run MSTest V2 tests with VSTest, ensure that the test adapter is located in the tested project output directory.
  • Results of MSTest and MSTest V2 parameterized tests are accumulated and reported as a single test due to the MSTest framework limitations.

Examples

Your command line may resemble the following:

  • Running tests without collecting coverage information

    dottestcli.exe -solution "C:\Devel\FooSolution\FooSolution.sln" -config "builtin://Run VSTest Tests" -report "C:\Report" 
  • Running tests and collecting coverage information

    dottestcli.exe -solution "C:\Devel\FooSolution\FooSolution.sln" -config "builtin://Run VSTest Tests with Coverage" -report "C:\Report" 

Running NUnit and MSTest Tests

We strongly recommend that you execute your NUnit and MSTest test with the VSTest test configurations. The framework-specific test configurations are shipped with dotTEST for legacy purposes.

  • No labels