dotTEST allows you to monitor and collect coverage data from managed code during manual or automated functional tests performed on a standalone or web application.
In typical workflows, dotTEST collects coverage for web applications deployed on IIS server. You can collect coverage data from managed code during tests performed on a running web application that is deployed on IIS server. .NET web applications are supported. Alternatively, the application can be run as a desktop application (for example, using dotnet.exe or application executable if it is a .NET application).
Coverage can be collected using a dedicated dotTEST application coverage UI or the command line. You can send coverage data and test results to DTP, which merges and correlates the data. The application coverage information can be displayed in the DTP Coverage Explorer, which provides insights about how well the application is tested, as well as the quality of your tests. For details, see the "Coverage Explorer" chapter in the DTP User Guide.
dotTEST ships with a component called the coverage agent, which makes it possible to collect coverage for applications using REST client API for coverage engine (agent_client.exe). The tool facilitates collecting coverage information from managed code during execution of standalone and web applications. Running agent_client.exe
launches a UI. Alternatively, you can provide the information with the dedicated command line options.
dotTEST enables you to generate a local coverage report and upload the results to DTP.
You can leverage the capabilities of the |
The dotTEST coverage agent is attached to the application under test (AUT) and monitors the code being executed as the AUT runs. When the coverage agent is attached to the AUT, a REST API is exposed that enables you to mark the beginning and end of each test and test session. During test execution, interactions with the coverage agent and AUT are written to a dynamic coverage data file, which contains markers that specify which lines of code were touched.
Metadata about the lines of code that can be covered (static coverage data) is collected either by running a dedicated test configuration or by scanning the application assemblies. During test execution, interactions with the coverage agent are written to dynamic coverage data files, which contains markers that specify which lines of code were touched.
Dynamic coverage is not reported for files other than .cs or .vb. |
dotTEST processes the dynamic coverage and static coverage data. A coverage.xml file, which contains the coverage information, is produced and sent to DTP. When DTP receives the coverage data, it is loaded into a coverage image, which is a special tag that enables you to aggregate coverage data from runs with the same build ID. The coverage image enables you to associate coverage information with specific tests.
dotTEST can also collect application coverage which includes only runtime coverage and general information about the classes that have been executed without any details about the source code structure other than the lines that have been covered. A simplified report is then sent and appended to existing coverage data on DTP. The coverage data can be viewed if information about class structure (static coverage data) is already available on DTP.
Test results are also sent to DTP from the tool executing the tests (that is, SOAtest, tests executed by dotTEST, manual tests, etc.) in a report.xml file. If the build IDs for the coverage data (coverage.xml) file and the report match, DTP is able to correlate the data and display the coverage information.
You can use either dottestcov
or the dottestcli
to create a coverage report and upload the data to DTP. dottesctcov
is a dedicated tool for coverage and offers more options in terms of collecting, merging and creating coverage reports, see Creating a Coverage Report and Uploading the Data to DTP. The dottestcov.bat file is located in the <INSTALL_DIR>\integration\coverage\dottestcov
directory.
Agent_client.exe
and dottestcov
are standalone tools that can be copied out from dotTEST installation directory and used independently. Therefore, you can easily integrate them within your testing flow. For details about the agent client command line options, see Command Line Options for Agent Client. For details about dottestcov
command line options, see Command Line Options for dottestcov.
Ensure that the Visual C++ Redistributable Packages that are shipped with dotTEST are installed on the machine where the monitored application will be run. They are automatically installed when you install dotTEST with the wizard (see Installation). If you install dotTEST from a ZIP distribution, or if you are going to collect coverage on another machine, install the packages manually by running the executables located in the <INSTALL_DIR>\bin\prerequisites
directory.
The monitored application can be installed on the same machine where dotTEST is installed, or on another machine.
If you use a source control system, ensure that your source control settings are properly configured; see Source Control Settings.
Additionally, for web applications deployed on IIS server:
LoadUserProfile
option to be set to true
in the ISS Management Console.The dottestcov
tool can be run on the following operating systems:
The dottestcov
tool requires Java 11 or higher to be installed on your machine. Both Oracle Java SE and OpenJDK are supported. Other free and open source implementations may cause issues with the proper functioning of the coverage tool. It is recommended to set JAVA_HOME
and add it to the system PATH.
Also, ensure the proper .NET framework is installed on your machine:
dottestcov
on Linux)dottestcov
on Windows)Follow these steps to collect coverage from all the web applications residing on the configured IIS server:
agent_client.exe |
If you provide 0 or a negative value, the connection attempt will not timeout, which may lead to a considerable slowdown or cause the tool to hang indefinitely. |
Follow these steps to collect coverage for a specified standalone or web application:
agent_client.exe |
If you provide 0 or a negative value, the connection attempt will not timeout, which may lead to a considerable slowdown or cause the tool to hang indefinitely. |
The following steps are required to collect coverage using CLI:
Generating the static coverage file is required if you want create to a report containing merged static coverage (including source code information) and runtime coverage.
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 indicates where the static coverage data is saved, for example:
Saving static coverage information into: 'C:\Users\[USER]\Documents\Parasoft\dotTEST\Coverage\Static\[FILE].xml |
This static coverage file can be used with dottestcli
and dottestcov
to be merged with runtime coverage data and sent to DTP.
Generate the static coverage file by running the following command:
dottestcov.bat -app [dir] |
Where -app
specifies the path to the Application Under Test directory.
<INSTALLATION_DIR>\integration\coverage\agent
directory to the machine where IIS is installed and the web application is deployed.Deploying the agent in the home directory (%USERPROFILE% directory) is not recommended, as it may prevent coverage collection from web-based applications. |
Invoke the Agent Client tool on this machine to enable runtime coverage collection inside IIS:
agent_client.exe |
You may need to configure the Agent Client with additional options, see Command Line Options for Agent Client.
The Agent Client initializes the environment for the web server (IIS) and behaves like a service, enabling you to execute tests and collect coverage. The service is ready and waiting for commands as long as the following message is printed to the output:
Write 'exit' and hit Enter to close agent_client |
A test session and test can be started even if the tested website or application has not been loaded yet. |
Go to the following address to check the status of the coverage agent: http://host:8050/status
You should receive the following response:
{"session":null,"test":null} |
By default, the coverage agent is available via the HTTP protocol. To connect via HTTPS, you need to bind an SSL certificate to the port used by the coverage agent. This can be achieved in one of the following ways:
By adding your SSL certificate to a storage accessible from the Netsh.exe tool and passing the hash of the certificate and the port number to agent_client.exe:
agent_client.exe -port 8050 -useSsl -certificateHash <SSL certificate hash> |
By passing the path and password to an SSL certificate stored in a .pfx file and the port number to agent_client.exe:
agent_client.exe -port 8050 -useSsl -certificatePath <path to PFX> -certificatePassword <password> |
By configuring a port with an SSL certificate and the appid
of the Agent Client for the Netsh.exe tool. The Agent Client has the following ID:
{ed344e08-fab7-4dfb-9d07-68f2c2c9e373} |
When the SSL certificate is configured in the Netsh.exe tool, you can connect via HTTPS by launching the Agent Client with the -port
and -useSsl
switches:
agent_client.exe -port 8050 -useSsl |
To use a self-signed certificate, you must add the -skipvalidation
option.
You can use an SSL certificate in the in PFX or PKCS12 format.
By default, the Agent Client automatically handles certificates configured for the coverage agent. To manually remove a certificate, launch the Certmgr.exe tool and remove the certificate stored in Personal > Certificates.
If you manually unregister the coverage service port using the Agent Client with the -unregister
switch, you need to add the -useSsl
and -removeCertificate
switches to remove the SLL certificate:
agent_client.exe -unregister -port 8050 -useSsl -removeCertificate |
This will delete the SSL certificate from the port number. You can now manually remove the certificate from the storage.
To collect coverage using CLI, run agent_client.exe
with the dedicated command line options to specify the information necessary for collecting application coverage.
For IIS applications:
agent_client.exe -port 8050 |
For desktop applications:
agent_client.exe -app [path] -workingDir [path] -appArgs [arguments] |
You can collect coverage information for multiple users that are simultaneously accessing the same web application server. This requires launching the Agent Client with the -multiuser
switch:
agent_client.exe -multiuser |
By default, the Agent Client application pool processes are recycled after 20 minutes of idle time, which can have negative consequences on a test session. You can prevent this behavior by changing the default value so that people working with the application do not experience unexpected stops and restarts during a test session.
To collect runtime coverage:
You can stop the process of collecting runtime coverage data in one of the following ways:
Write exit
in the open console when the following message will be printed to the output to stop the agent client:
Write 'exit' and hit Enter to close agent_client |
Send a request to the service by entering the following URL in the browser: http://host:port/shutdown
Agent client is stopped only when all test sessions are finished. Application coverage will no longer be collected when the service stops, so it is important that the agent client runs continuously while performing tests to collect coverage. |
If any errors occur when the agent client exits, which prevent the clean-up of the Web Server environment, then execute the agent client with the -uninitialize
option to restore the original Web Server environment and settings:
agent_client.exe -uninitialize |
Follow these steps to upload the test results from the executed tests to DTP:
If you use SOAtest, test results are automatically sent to DTP during test execution. See the Application Coverage section in the SOAtest user guide at https://docs.parasoft.com.
You can use either the dottestcov
or the dottestcli
command to create a coverage report and upload the data to DTP. For details about dottestcov
command line options, see Command Line Options for dottestcov.
There are 3 types of coverage report that can be generated:
dottestcli
with the -runtimeCoverage
and -staticCoverage
switches or dottestcov
with the -runtime
and -static
switches.dottestcov
with the -app
and -runtime
switches.dottestcov
with the -runtime
switch.Follow the procedure below to create a coverage report and upload the data to DTP:
dottestcli/dottestcov
is properly configured, including DTP, scope, and authorship settings. See Connecting to DTP, Sending Results and Publishing Source Code to DTP, Configuration.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 40).dottestcli
, 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 data collected using the coverage agent. 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 with Source Code Information).-publish
- sends the merged coverage to DTP.
dottestcli.exe -runtimeCoverage [path] -staticCoverage [path] -publish |
This ensures that dotTEST has access to the runtime coverage data generated during test execution, as well as the static coverage data, which is required to fill the coverage.xml file with runtime coverage data.
dottestcov
, run dottestcov
with the following switches:-app
- specifies the path to the Application Under Test directory or archive file.-runtime
- specifies the path to runtime coverage data collected using the coverage agent. 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.-static
- specifies the path to the static coverage file (see Generating the Static Coverage File with Source Code Information).-publish
- sends the merged coverage to DTP.
Example 1: Generating a report based on runtime data and static coverage from the monitor
dottestcov.bat -static [path to static_coverage.xml file] -runtime [path/dir] -publish -settings [path to .properties] |
Example 2: Generating a report based on runtime data and coverage from the application binaries
dottestcov.bat -app [dir] -runtime [path/dir] -publish -settings [path to .properties] |
Example 3: Generating a report based on runtime data
dottestcov.bat -runtime [path/dir] -publish -settings [path to .properties] |
If you want to merge previously generated runtime coverage reports, run the dottestcov merge
command. To merge two or more reports, run
dottestcov.bat merge -coverage <REPORT_FILE> -coverage <REPORT_FILE> [-coverage <REPORT_FILE>] [-report <REPORT_DIR>] [-excludeunmatchedruntime] |
-coverage <REPORT_FILE>
- specifies one or more input coverage reports to merge and publish to DTP.-report <REPORT_DIR>
- (optional) generates an xml coverage report to the given folder. By default the report is stored to the .coverage/reports folder.If you use SOAtest, static and runtime coverage data are merged and sent to DTP during test execution. See the "Application Coverage" section in the SOAtest User Guide.
By default, coverage is measured for the entire application. To narrow down the scope of collecting coverage, provide paths to the selected parts of the application with the -solution,
-resource
, -include
, and/or -exclude
options (see Configuring the Test Scope for details) when generating static coverage. As a result, dotTEST will generate a scope configuration file that would include the customized scope for collecting static coverage.
You do not need to modify the content of the scope configuration file. However, if you collect coverage for large applications, you may want to additionally fine-tune the scope of collecting runtime coverage (that is, coverage collected while interacting with the application under test) to optimize performance. To customize collecting runtime coverage, open the scope.instumentation.txt file and remove the the assemblies for which you do not want to collect coverage data from the list of assemblies.
It is not possible to use the application coverage scope file for web projects that are compiled on IIS. This is because the target assemblies of IIS compilations are named unpredictably. Scope files can be used safely when the assembly name loaded by IIS can be predetermined before coverage collection starts. |
To narrow down the scope of collecting coverage:
Add the paths to resources to your command line (see Generating the Static Coverage File with Source Code Information), for example:
dottestcli.exe -config "builtin://Collect Static Coverage" -solution "C:\Devel\FooSolution\FooSolution.sln" -resource "FooSolution/QuxProject" -include "C:\Devel\FooSolution\src\QuxProject\**\*.cs" -exclude "C:\Devel\FooSolution\src\QuxProject\**\tests\**\*.cs" |
When static coverage is generated, the scope information is stored in a scope configuration file. The output from the console indicates the location of the scope configuration file, for example:
Saving static coverage scope configuration into: 'C:\Users\[USER]\Documents\Parasoft\dotTEST\Coverage\Static\scope.instrumentation.txt' |
Pass the path to the scope configuration file to the Agent Client tool (see Attaching the Coverage Agent to the AUT) with the -scope
option, for example:
agent_client.exe -scope 'C:\Users\[USER]\Documents\Parasoft\dotTEST\Coverage\Static\scope.instrumentation.txt' |
By default, coverage is measured for the entire application. To narrow down the scope of collecting coverage, execute:
dottestcov.bat -include "MyAssembly.dll/*" -exclude "MyAssembly.dll/packageA.*" -app [dir] -runtime [path/dir] -publish -settings [path to .properties] |
You can use the Coverage Explorer in DTP to review the application coverage achieved during test execution. For details on viewing coverage information, see the DTP User Guide.