In this section:
Overview
The dotTEST coverage agent 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 Parasoft Coverage Agent Manager User Guide.
Both workflows, with and without the coverage agent REST client, enable you to generate a local coverage report and upload the results to DTP.
dotTEST ships with the coverage_wizard.exe
tool that facilitates collecting coverage information from managed code during execution of standalone applications. Running coverage_wizard.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.
Configuring the Coverage Wizard
Run the <
INSTALL_DIR>\coverage_wizard.exe
tool and specify the following information:
- Full path to the application
- Command line arguments
- Working directory
- Full path to engine directory- Specify the .NET CLR version used by the application.
- Specify a directory where the scripts generated by the wizard will be saved.
Specify if you want to collect coverage information with or without the coverage agent REST client:
- 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.- Define the scope of coverage to import by providing
-solution
or-project
switches that will be passed to the dotTEST executable so that it can locate sources. See Configuring the Test Scope 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, runtime coverage information that was collected during previous executions is deleted. Disabling this option will prevent removing the data from previous runs.
- Enable or disable the Run application immediately option to automatically launch the
monitorCoverage.bat
script ( if enabled, the application must be manually launched with the script generated by the wizard in the location specified in step 3).
Using the Command Line Options
You can run coverage_wizard.exe
with the dedicated command line options to specify the information necessary for collecting application coverage:
coverage_wizard.exe -app [path] -workingDir [path] -appArgs [arguments] -commandsDir [path] -scope [dotTEST scope switch] -clr [version] -run
The following options are available:
Option Name | Value | Description |
---|---|---|
-app | [path] | Specifies the full path to the application. |
-workingDir | [path] | Specifies the path to the working directory. |
-appArgs | [argument] | Specifies the application command line arguments. |
-commandsDir | [path] | Specifies the directory for the *.bat scripts generated by the coverage tool. |
-scope |
| Specifies the scope of the coverage to import by providing
See Configuring the Test Scope for more information about the switches. |
-clr |
| Specifies the .NET CLR version used by the application; |
-run | none | Automatically launches the monitorCoverage.bat script (optional; you can also open the directory specified with the -commandDir option and manually run the script). |
-doNotRemoveOldCoverage | none | 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. |
-withCoverageAgent | none | Specifies that coverage is collected with the coverage agent. |
Collecting Coverage without Coverage Agent REST Client
If you configure the coverage wizard to run without the coverage agent REST client, the tool creates the following scripts in the directory specified as the Target scripts directory (see Configuring the Coverage Wizard):
monitorCoverage.bat
runs and monitors the applicationimportCoverage.bat
imports and reports coverage data
- Run the
monitorCoverage.bat
script (skip this step if you launched the coverage wizard with the Run application immediately option enabled). This will run the specified application. - Interact with the application and perform your tests.
- Close the application.
- Run the
importCoverage.bat
script to generate the report in the following location: [Target scripts directory]\reports. - View the coverage information.
Collecting Coverage with Coverage Agent REST Client
If you configure the coverage wizard to run with the coverage agent REST client, the tool creates the following scripts in the directory specified as the Target scripts directory (see Configuring the Coverage Wizard):
monitorCoverage.bat
runs and monitors the applicationrunCamAgent.bat
runs the coverage agent
To collect application coverage with the coverage agent:
Generate the static coverage file with source code information; see Generating the Static Coverage File with Source Code Information.
Run the
runCamAgent.bat
script to launch the coverage agent.Do not close the coverage agent process until you stop working with CAM.
Run the
monitorCoverage.bat
script to launch the application.Connect with Coverage Agent Manager and perform testing; see Parasoft Coverage Agent Manager for details.
Download runtime coverage and test results.
Close the application.
By default, the coverage agent is available via the HTTP protocol. If you want to connect via HTTPS, open the runCamAgent.bat
script before you run it and modify the command line for running the Agent Client tool to pass the information about an SSL certificate, for example:
"<INSTALL_DIR>\integration\coverage\agent\agent_client.exe" -standalone -port 8050 -useSsl -certificateHash <SSL certificate hash> -camConfigFile <path to camConfigFile>
See Connecting with the Coverage Agent via HTTPS and Agent Client Options for details about configuring an SSL certificate for the coverage agent and a list of available options.
Collecting Coverage without Admin Privileges
By default, dotTEST requires admin privileges to collect coverage with coverage agent REST client, but you can configure the tool to collect coverage by users without admin privileges.
- Enable the Collect coverage without admin privileges option (see Configuring the Coverage Wizard) and launch the wizard. As a result, two additional .bat scripts will be generated:
- runCamAgentInit.bat
- runCamAgentUninit.bat Run the
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 REST Client.When testing is completed, run the
runCamAgentUninit.bat
script to stop the process
Creating a Coverage Report and Uploading the Data to DTP
See Creating a Coverage Report and Uploading the Data to DTP.