In this section:

Running Unit Tests with Coverage

You can run NUnit tests with or without coverage analysis. Coverage information is collected by running a dedicated test configuration. The built-in test configuration for collecting coverage is Run NUnit Tests with coverage.

Running NUnit Tests

Run one of the built-in test configurations for running NUnit tests on the scope of analysis. See Configuring Test Configurations for details on using the -config switch.

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 NUnit Tests" -report "C:\Report" 
  • Running tests and collecting coverage information

    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

  1. MSTest must be integrated with UTC 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.
  2. Run one of the built-in test configurations for MSTest test and extend your dottestcli.exe command to include the build script that invokes mstest.exe:

    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 by dottestcli.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.

  • No labels