Introducing dotCover Console Runner
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 to start console runner for all corresponding test runners and get several coverage snapshots. Then, you can use the merge command to merge the snapshots.
Generate coverage reports in different formats.
Use report command to generate reports in desired formats from coverage snapshots.
In this topic:
To set up dotCover Console Runner on a server
- Open the dotCover | Remote Coverage options page.
- Click Get Server Package. dotCover will generate an archive with all necessary files.
- Copy the archive to the machine where you are going to set up the Console Runner.
- Extract files from the archive to a directory, from which you are going to start the Console Runner executable file (dotCover.exe).
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
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>
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.
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.
Finding symbol files (PDB)
Locating symbol files (PDB) for the target binaries is vital for calculating coverage. If you cover unit tests or cover the startup project, dotCover easily locates symbol files using the structure of the current solution.
By default, dotCover search symbol files in the following places:
- in the same directory where the binary file resides;
- in the debug directory that is specified inside the binary file;
- in all directories specified in the
_NT_SYMBOL_PATHenvironment variable and in the registry;
SymbolSearchPathsparameter to provide a semicolon separated list of paths to search for symbol files. Each path can be either a directory path or a symbol server path (e.g. srv*C:\LocalSymbols*http://symbolserver:33417/).
AllowSymbolServerAccessparameter to allow dotCover access symbol servers specified either in the
SymbolSearchPathsparameter, or in