dotCover Web Help

dotCover console runner is a console application included in the dotCover distribution package ( [Program Files]\JetBrains\dotCover\[version]\bin\dotCover.exe ). The main tasks of this application are following:

  • Control execution of any test runner (MSTest, NUnit, xUnit, MSpec, etc.) and record coverage of executed tests in coverage snapshots.
  • Merge coverage snapshots.
    You may need to merge snapshots if, for example, you use several different formats of unit tests in your project or solution. In this case, you will have start console runner for all corresponding test runners and get several coverage snapshots. Use merge command to merge the snapshots.
  • Generate coverage reports in different formats.
    Use report command to generate reports in desired formats from coverage snapshots.

Among the Console Runner Commands, the most useful is analyse. It combines all common tasks and generates coverage report as the output.

Configuration of console runner is very simple and can be done via command line parameters or XML configuration files.

The example below illustrates usage of the analyse command:

dotCover analyse config.xml

Where config.xml contains the necessary configuration parameters, e.g:

<?xml version="1.0" encoding="utf-8"?>
<AnalyseParams>
  <TargetExecutable>D:\Program Files\NUnit 2.6\bin\nunit-console.exe</TargetExecutable>
  <TargetArguments>D:\Projects\TheApplication\bin\Debug\AppTests.dll</TargetArguments>
  <Output>AppCoverageReport.html</Output>
  <ReportType>html</ReportType>
</AnalyseParams>
<Filters>
  <ExcludeFilters>
    <FilterEntry>
      <ClassMask>IntegrationTests</ClassMask>
    </FilterEntry>
  </ExcludeFilters>
</Filters>
        

Tip

A stub for the config file for each command could be generated automatically by typing

dotCover help analyse config.xml

in the command line. The sample config file would be created with comments indicating what each element means.

Besides test coverage reports, you can get a raw coverage snapshot by using the cover command. You can then open and analyze the snapshot in the standalone dotCover application or in the Visual Studio.

Note

The only limitation of coverage snapshots obtained with the console runner is that they do not contain per-test coverage results, i.e, the following analysis features are unavailable: Viewing Total Coverage of Particular Unit Test Item and Navigation to Covering Tests.