In this section:
dotTEST ships with the
coverage.exe tool that facilitates collecting coverage information from .NET managed code during execution of standalone applications. Running
coverage.exe launches a wizard that allows you to specify the necessary information in the GUI. Alternatively, you can provide the information with the dedicated command line options.
Additionally, dotTEST ships with a component called the coverage agent, which can be enabled or disabled when coverage information is being collected. Enabling the coverage agent allows you to connect with the Coverage Agent Manager (CAM) - a web interface for measuring coverage with a wide range of testing techniques; see the Coverage Agent Manager (CAM) section of the DTP documentation for details.
Both workflows, with and without the coverage agent, enable you to generate a local coverage report and upload the results to DTP.
dotTEST can collect coverage for .NET Core standalone applications (configuring additional dependencies with the dedicated environment variable or the dotnet.exe command line switch
You can leverage the capabilities of the the
Note: In typical workflows, dotTEST collects coverage for web applications deployed on IIS server (see Application Coverage for Standalone Applications).
[INSTALL_DIR]\coverage.exe tool and specify the following information:
- Full path to the application
- Command line arguments
- Working directory
Complete the Full path to the application field with the path to
Specify if you want to collect coverage information with or without the Coverage Agent:
- If you enable the Use Coverage Agent option, enable or disable the Collect coverage without admin privileges option (see Collecting Coverage without Admin Privileges), then skip steps 5-7 and click Finish.
- If you enable the Without Coverage Agent option (default), proceed to steps 5-7.
-projectswitches that will be passed to the dotTEST executable so that it can locate sources. See for more information about the switches.
Enable or disable the Remove old coverage data before each run option. This option is enabled by default.
By default, dynamic coverage information that was collected during previous executions is deleted. Disabling this option will prevent removing the data from previous runs.
monitorCoverage.batscript ( if enabled, the application must be manually launched with the script generated by the wizard in the location specified in step 3).
You can run
coverage.exe with the dedicated command line options to specify the information necessary for collecting application coverage:
coverage.exe -app [path] -workingDir [path] -appArgs [arguments] -commandsDir [path] -scope [dotTEST scope switch] -clr [version] -run
The following options are available:
|Specifies the full path to the application.|
|Specifies the path to the working directory.|
|Specifies the application command line arguments.|
|Specifies the directory for the *.bat scripts generated by the coverage tool.|
Specifies the scope of the coverage to import by providing
|Specifies the .NET CLR version used by the application;|
|Automatically launches the |
Specifies that old coverage data is not deleted before each run. If this option is not specified, coverage data collected during previous runs is deleted by default.
|Specifies that coverage is collected with the Coverage Agent.|
If you configure the coverage wizard to run without the coverage agent, the tool creates the following scripts in the directory specified as the Target scripts directory (see Configuring the Coverage Wizard):
monitorCoverage.batruns and monitors the application
importCoverage.batimports and reports coverage data
monitorCoverage.batscript (skip this step if you launched the coverage wizard with the Run application immediately option enabled). This will run the specified application.
importCoverage.batscript to generate the report in the following location: [Target scripts directory]\reports.
If you configure the coverage wizard to run with the coverage agent, the tool creates the following scripts in the directory specified as the Target scripts directory (see Configuring the Coverage Wizard):
monitorCoverage.batruns and monitors the application
runCamAgent.batruns the Coverage Agent
runCamAgent.bat script to launch the Coverage Agent.
Do not close the Coverage Agent process until you stop working with CAM.
monitorCoverage.bat script to launch the application.
Connect with Coverage Agent Manager and perform testing.
Download coverage and test results; see Coverage Agent Manager (CAM) section of the DTP documentation for details.
Close the application.
By default, dotTEST requires admin privileges to collect coverage with Coverage Agent, but you can configure the tool to collect coverage by users without admin privileges.
runCamAgentInit.bat script with admin privileges to setup and initialize the Coverage Agent. This will enable the users without admin privileges to perform testing with CAM, as described in Collecting Coverage with Coverage Agent.
When testing is completed, run the
runCamAgentUninit.bat script to stop the process.
To view coverage information collected with CAM, you need to upload the test results and coverage to DTP.
To upload the coverage to DTP, you need to merge the runtime coverage that you downloaded form CAM with the static coverage generated by the Coverage Agent. To properly merge and upload the coverage data, ensure that the required settings are configured in the .properties file (see Configuration Overview):
report.coverage.images- Specifies a set of tags that are used to create coverage images in DTP. A coverage image is a unique identifier for aggregating coverage data from runs with the same build ID. DTP supports up to three coverage images per report.
session.tag- Specifies a unique identifier for the test run and is used to distinguish different runs on the same build.
build.id- Specifies a build identifier used to label results. It may be unique for each build, but it may also label several test sessions executed during a specified build.
report.coverage.limit(optional) - Specifies the lower coverage threshold. Coverage results lower than this value are highlighted in the report (the default value is
Generate the static coverage file by running the following test configuration on the solution:
dottestcli.exe -config "builtin://Collect Static Coverage" -solution SOLUTION_PATH
The dottestcli console output will indicate where the static coverage data is saved:
Saving static coverage information into: 'C:\Users\[USER]\Documents\Parasoft\dotTEST\Coverage\Static\[FILE].data
Copy the runtime coverage and static coverage files to the same machine and run
dottestcli with the following switches:
-runtimeCoverage: Specifies the path to runtime coverage that you download with CAM (see Coverage Agent Manager (CAM) section of the DTP documentation for details). You can provide a path to an individual .data file with coverage information from one testing session, or a path to a folder that contains many .data files from multiple testing sessions.
-staticCoverage: Specifies the path to the static coverage file (see Generating the Static Coverage File).
dottestcli.exe -runtimeCoverage [path] -staticCoverage [path] -report [path] -publish -settings [path]
The coverage data will be automatically uploaded to DTP.
You can use the Coverage Explorer in DTP to review the application coverage achieved during test execution. See the DTP documentation for details on viewing coverage information.