...
In this section:
Table of Contents | ||
---|---|---|
|
Anchor | ||||
---|---|---|---|---|
|
VSTest 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 scopeRun VSTest Tests with Coverage
- executes unit tests in the tested scope, and collects coverage information
SeeConfiguring Test Configurations for details about specifying a test configuration.
Info | ||
---|---|---|
| ||
|
Examples
Your command line may resemble the following:
Running tests without collecting coverage information
Code Block dottestcli.exe -solution "C:\Devel\FooSolution\FooSolution.sln" -config "builtin://Run VSTest Tests" -report "C:\Report"
Running tests and collecting coverage information
Code Block dottestcli.exe -solution "C:\Devel\FooSolution\FooSolution.sln" -config "builtin://Run VSTest Tests with Coverage" -report "C:\Report"
Running NUnit Tests
You can execute NUnit Tests by running one of the following built-in configurations:
Run NUnit Tests
- executes NUnit tests in the tested scopeRun NUnit Tests with Coverage
- executes NUnit tests in the tested scope, and collects coverage information
Examples
Your command line may resemble the following:
Running tests without collecting coverage information
Code Block dottestcli.exe -solution "C:\Devel\FooSolution\FooSolution.sln" -config "builtin://Run NUnit Tests" -report "C:\Report"
Running tests and collecting coverage information
Code Block dottestcli.exe -solution "C:\Devel\FooSolution\FooSolution.sln" -config "builtin://Run NUnit Tests with Coverage" -report "C:\Report"
All files associated with NUnit integration are shipped in the [INSTALL_DIR]\integration\NUnit-2.6.3
directory.
Running MSTest Tests
You can execute NUnit Tests by running one of the following built-in configurations:
Execute MSTests
- executes MSTest tests in the tested scopeExecute MSTests with Coverage
- executes MSTest tests in the tested scope, and collects coverage information
- MSTest must be integrated with dotTEST to run MSTest tests. If you did not integrate with MSTest during installation, you can run
Deploy.exe
in the MSTest integration directory:[INSTALLATION_DIR]\integration\MSTest\Deploy.exe
. Run one of the built-in MSTest configurations and extend your dottestcli.exe command to include the build script that invokes
mstest.exe
:Code Block dottestcli.exe -solution "FooSolution.sln" -config "builtin://Execute MSTests with Coverage" -report "Report" -- "Run_tests.bat"
The
--
separator indicates the end of the dotTEST command line; arguments following--
from a command line that is invoked bydottestcli.exe
.
In the above example, dotTEST launches the Run_tests.bat
script and listens to all MSTests executed in the script as it runs. Unit test results are collected and code coverage is measured for FooSolution.sln.