Conditional Content | ||||||
---|---|---|---|---|---|---|
| ||||||
In this section:
IntroductionYou can monitor and collect coverage data during manual or automated functional tests performed on a running web application server. You can also 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 (see the "Coverage Explorer" chapter in the DTP user manual), which provides insights about how well the application is tested, as well as the quality of your tests. PrerequisitesThe following components are required for collecting coverage:
Java JDK 8 line break calculations in bytecode are inconsistent with previous Java versions. This may lead to inconsistencies in coverage results.
Process OverviewJtest DTP Engine ships with a component called the coverage agent. The 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. Metadata about the lines of code that can be covered (static coverage data) is collected by running a dedicated test configuration as part of the application build process. 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's 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. Test results are also sent to DTP from the tool executing the tests (i.e., SOAtest, tests executed by the DTP Engine, manual tests, etc.) in a report. |
...
xml file. If the build IDs for the coverage data file and the report match, DTP is able to correlate the data and display the coverage information. Configuring the Application Under Test for CoverageThe following steps are required to prepare the application under test (AUT):
|
...
|
...
|
...
The package that contains the static coverage file is created during the build process by the Jtest Maven, Gradle or Ant plugin. It must be generated on the build machine that contains the source code. The static coverage file can be used until the code changes. In order to generate the package that contains the static coverage file, you need to execute an appropriate command in the AUT's main directory. Maven
Gradle
Ant
The monitor.zip package will be generated and placed into the build output directory. The path to the location will be printed on the console. The package contains the following:
|
...
|
...
|
...
Application servers usually contain more than one application. Additionally, common server classes or application libraries do not need to be instrumented. The Jtest DTP Engine only needs to collect coverage for application source code. Instrumenting all classes would be too time-consuming. The application on the server is already built, so we cannot gather information about which classes come from the source code. For this reason, properly setting the scope of the coverage agent is very important. You can configure the coverage agent with:
|
...
The agent.properties file is generated in the monitor.zip package ( |
...
see Generating the Static Coverage File). It contains properties that can be modified to properly configure the coverage agent. The following example shows how the coverage agent can be configured with the agent.properties.file:
Adding properties to |
...
requires modifying their names by removing the "jtest.agent" prefix, for example:
The following table describes all properties that can be used to configure the coverage agent:
|
...
|
...
|
...
Test Configuration and ExecutionYou can use SOAtest to run functional tests (refer the Application Coverage chapter of the SOAtest documentation to set up the test configuration), as well as execute manual tests. At the end of the test session, coverage will be |
...
saved in |
...
files in the directory specified in SOAtest. This information will eventually be merged with the static coverage data to create |
...
a |
...
file and uploaded to DTP. Uploading Test Results to DTPIf you use Jtest with CAM
|
...
If you use SOAtestFor tests executed by SOAtest, the SOAtest XML report will need to be uploaded to DTP. See the "Uploading Rest Results to DTP" section in the Application Coverage topic in the SOAtest documentation for details. Generating a Dynamic Coverage Data File and Uploading It to DTP
|
...
|
...
|
...
|
...
|
...
|
...
Reviewing Coverage in DTPYou can use the Coverage Explorer in DTP to review the application coverage achieved during test execution. See the DTP documentation for details on viewing coverage information. Known Limitations
|
...
|
...
|
...
|
...
|