dotCover console runner is a console application included in the dotCover distribution package. 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.
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 following configuration parameters:
<?xml version="1.0" encoding="utf-8"?> <AnalyseParams> <Executable>D:\Program Files\NUnit 2.6\bin\nunit-console.exe</Executable> <Arguments>D:\Projects\TheApplication\bin\Release\AppTests.dll</Arguments> <Output>AppCoverageReport.html</Output> <ReportType>html</ReportType> </AnalyseParams> <Filters> <ExcludeFilters> <FilterEntry> <ClassMask>IntegrationTests</ClassMask> </FilterEntry> </ExcludeFilters> </Filters>
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 Visual Studio if you have dotCover installed on your local computer.
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.