...
You can collect coverage information during unit test execution by running special commands on the following build systems:
- Maven
- Ant
- Gradle
...
Jtest goals (Maven) or tasks (Ant and Gradle).
- Configure the Jtest plugin for your build system:
Configuring the Jtest Plugin for Maven
Configuring the Jtest Plugin for Gradle
Configuring the Jtest Plugin for Ant - Execute your tests with the dedicated Jtest goals/tasks:
Collecting Coverage for Unit Tests with Maven
Collecting Coverage for Unit Tests with Gradle
Collecting Coverage for Unit Tests with Ant
Info |
---|
Associating coverage information collected during unit test execution is supported for JUnit 4 only. |
Sending Coverage Information to DTP
In order to collect coverage information and send it to DTP, run the built-in The Unit Tests configuration during test execution. Maven is used in the following example:
Code Block |
---|
mvn clean test-compile jtest:instrument jtest:jtest -Djtest.config="builtin://Unit Tests" |
See Unit Testing 1 for information about setting up and executing unit tests.
Merging Coverage Data
In order to properly merge coverage data in DTPtest configuration automatically sends the results to DTP. To ensure the coverage data is properly merged, you must specify one or more coverage image tags in the command line or .properties settings file. The coverage image(s) is automatically sent to the connected DTP server where it can be associated with a filter.
...