...
Metadata about the lines of code that can be covered (static coverage data) is collected either by running a dedicated test configuration as part of the application build process or by scanning the application jarsbinaries. During test execution, interactions with the coverage agent are written to a dynamic coverage map, which contains markers that specify which lines of code were touched.
Jtest processes the dynamic coverage map 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.
Jtest can also collect partial application coverage , which includes only runtime coverage and general information about the classes that have been executed without any details about the class structure other than the lines that have been covered. A simplified report is then sent and appended to existing coverage data on DTP. The partial coverage data can be viewed if information about source code is already available on DTP.
...
- A static and runtime coverage report: a report containing merged static coverage (including source code information) and runtime coverage. To create this report, run
jtestcli
with the-runtimeCoverage
and-staticCoverage
switches orjtestcov
with the-runtime
and-static
switches. - An application coverage report: a static coverage report created by scanning application jars binaries and runtime coverage. To create this report, run
jtestcov
with the-app
and-runtime
switches. - A runtime coverage report: a simplified report containing partial application coverage , which includes report including only runtime coverage and general information about the classes that have been executed without any details about the class structure other than the lines that have been covered. The report can be viewed if there is already existing application or static coverage-based data on DTP. To create this report, run
jtestcov
with the-runtime
switch.
...
- Ensure that Jtest is properly configured, including DTP, scope, and authorship settings. See Connecting to DTP 1, Sending Results and Publishing Source Code to DTP, Configuration 1.
- Configure the following settings in the jtestcov.properties (located in the
<INSTALL_DIR>/integration/coverage
directory) or jtestcli.properties file in order to properly merge coverage data:
-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. - If you want to use
jtestcli
, copy the runtime coverage and static coverage files to the same machine and runjtestcli
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 Monitor Package).-config
: Specifies the URL of theCalculate Application Coverage
test configuration that must be run to merge the coverage data.-publish
: Sends the merged coverage to DTP.Code Block jtestcli -staticcoverage [path to static_coverage.xml file] -runtimecoverage [path/dir] -config "builtin://Calculate Application Coverage" -publish
This ensures that Jtest 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.
- If you want to use
jtestcov
, runjtestcov
with the following switches:-app
: Specifies the path to the Application Under Test directory or archive file.-runtime
: 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.-static
: Specifies the path to the static coverage file (see Generating the Monitor Package).-publish
: Sends the merged coverage to DTP.Example 1: Generating a report based on runtime data and static coverage from the monitor
Code Block java -jar jtestcov.jar -static [path to static_coverage.xml file] -runtime [path/dir] -publish -settings [path to jtestcov.properties]
Example 2: Generating a report based on runtime data and coverage from the application jarsbinaries
Code Block java -jar jtestcov.jar -app [path/dir] -runtime [path/dir] -publish -settings [path to jtestcov.properties]
Example 3: Generating a report based on runtime data
Code Block java -jar jtestcov.jar -runtime [path/dir] -publish -settings [path to jtestcov.properties]
If you want to merge previously generated partial runtime coverage reports, run the
jtestcov merge
command. To merge two or more reports, runCode Block java -jar jtestcov.jar merge -coverage <REPORT_FILE> -coverage <REPORT_FILE> [-coverage <REPORT_FILE>] [-report <REPORT_DIR>]
-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.
...
Merges previously generated partial runtime coverage reports. In order to merge two or more reports, run:
...