In this guide:
This guide is intended to help you collect coverage information for applications developed with .NET framework or Java technology.
The primary audience for this user guide are people responsible for ensuring compliance with your organization's policy regarding the application coverage level, including QA Engineers, developers, and build masters.
We assume that you are familiar with Parasoft technologies and have already deployed and licensed the following products:
The static coverage file must be generated on the build machine that contains the source code. The name of the file is static_coverage.xml.
Run the following test configuration on the solution:
dottestcli.exe -config "builtin://Collect Static Coverage" -solution SOLUTION_PATH |
The location of the static_coverage.xml file will be printed to the console.
The static coverage file is included in a monitor.zip package that is generated during the build process by the Jtest Plugin for Maven, Gradle, or Ant.
monitor
task or goal to your build command.Maven
mvn package jtest:monitor |
Gradle
gradle assemble jtest-monitor -I [INSTALL]/integration/gradle/init.gradle |
Ant
ant -lib [INSTALL]/integration/ant/jtest-ant-plugin.jar -listener com.parasoft.Listener jtest-monitor |
Ant requires all classes to be compiled before the monitor task is executed. Modify your project prior to the build and configure the task to ensure the correct sequence. The following example shows how the target can be configured:
|
Maven
mvn package jtest:monitor |
Gradle
gradle assemble jtest-monitor -I [INSTALL]/integration/gradle/init.gradle |
Ant
ant -lib [INSTALL]/integration/ant/jtest-ant-plugin.jar -listener com.parasoft.Listener jtest-monitor |
Ant requires all classes to be compiled before the monitor task is executed. Modify your project prior to the build and configure the task to ensure the correct sequence. The following example shows how the target can be configured:
|
static_coverage.xml
file will be printed to the console.Attaching the Coverage Agent to the AUT allows you enable collecting dynamic (runtime) coverage.
To attach the Coverage Agent to the AUT, you need to launch the IIS Manager tool shipped with dotTEST on the machine where IIS is installed and the AUT is deployed.
Invoke the following command to launch the IIS Manager tool:
dottest_iismanager.exe |
Go to the following address to check the status of the coverage agent: http://host:8050/status
. If the Coverage Agent is attached, you should receive the following response:
{"session":null,"test":null} |
To attach the Coverage Agent to the AUT, you need to add Jtest's -javaagen
t VM argument to the startup script of the server where the AUT is deployed.
Run the agent.sh/agent.bat script to print the Jtest Java agent VM argument to the console:
Jtest Agent VM argument: -javaagent:"[path to agent dir]\agent.jar"=settings="[path to agent properties file]\agent.properties",runtimeData="[path to monitor dir]\monitor\ runtime_coverage" |
-javaagent
argument to the application server’s startup script.Go to the following address to check the status of the coverage agent: http://host:8050/status
. If the Coverage Agent is attached, you should receive the following response:
{"test":null,"session":null,"testCase":null} |
You can connect to either CAM or SOAtest to the Coverage Agent. CAM provides an interface for starting and stopping test sessions. Connecting SOAtest enables you to collect application coverage during automated functional test execution.
Open CAM in a browser:
http://[your-Tomcat-host:port]/cam. |
You will first need to create a test configuration from the SOAtest UI.
To collect coverage data, you need to start a session. Only one tests session can be in progress at a time.
Execute the soatestcli using the application coverage test configuration to run your tests:
./soatestcli -config "/path/to/your/test-configuration/app-cov.properties" -data "/path/to/your/workspace" -resource "/path/to/your/tests/your_tests.tst" -localsettings "/path/to/your/localsettings/file/soatest-app-cov.properties" |
Uploading test results to DTP allows you to associate coverage data with individual tests and view the information on DTP.
dotTEST and Jtest can merge the dynamic and static coverage into one coverage.xml file, and send the merged information to DTP. To ensure that the coverage data is correctly merged and displayed on DTP, configure the following options in the .properties file where you configure your dotTEST or Jtest settings:
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.To merge the coverage data and send it to DTP, run dotTEST or Jtest with the following arguments:
-staticcoverage
- provides the path to the static_coverage.xml generated by dotTEST or Jtest-runtimeCoverage
- provides the path to the runtime_coverage_[timestamp].data downloaded via CAM or a path to a folder that contains many .data files from multiple testing sessions.-publish
- sends the merged coverage data to DTP-config
"builtin://Calculate Application Coverage"
- specifies the built-in test configuration required to merge the coverage dataYour command line may resemble the following:
dottestcli.exe -runtimeCoverage [path] -staticCoverage [path] -publish |
jtestcli -staticcoverage [path] -runtimecoverage [path/dir] -config "builtin://Calculate Application Coverage" -publish |
The
-publish
option is required to send the merged coverage data to DTP. Alternatively, you can configure the report.dtp.publish=
true
option in the .properties file where you configure dotTEST or Jtest.