...
- Generating the static coverage file.
The static coverage file is generated by Jtest or dotTEST in the .xml or .data format and contains metadata about user classes, methods, and lines. - Attaching the coverage agent to the application under test (AUT).
The coverage agent ships with Jtest and dotTEST, and allows you to monitor the code being executed when the AUT is running. - Configuring the Parasoft product that you use for application testing:
- SOAtest must be configured to connect to the coverage agent and collect runtime coverage, merge it with static coverage, and upload the data to DTP.
- Coverage Agent Manager (CAM) must be configured to connect with to the coverage agent.
- Performing tests on the AUT with your Parasoft product:
- SOAtest will collect runtime coverage, merge it with static coverage, and upload the merger data to DTP.
- CAM will collect runtime coverage and test results, which must be manually downloaded and sent to DTP (see steps 5-7).
- (CAM only) Downloading test results and the dynamic (runtime) coverage.
The data can be downloaded when a test session is finished and stopped in CAM. - (CAM only) Uploading the test results to DTP.
Test results are uploaded via the DTP interface. - (CAM only) Merging the dynamic and static coverage data and sending it to DTP.
Static and dynamic coverage is merged and uploaded to DTP by Jtest or dotTEST. - Reviewing the application coverage on DTP.
Application coverage is displayed in the DTP's Coverage Explorer.
Anchor | ||||
---|---|---|---|---|
|
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.
...
Attaching the Coverage Agent to the AUT allows you to enable collecting dynamic (runtime) coverage.
...
- Deploy the AUT to the application server.
- Copy the [DOTTEST_INSTALLATION_DIR]\integration\IIS directory to the machine were where IIS is installed and the AUT is deployed.
- Run a console as Administrator.
Invoke the following command to launch the IIS Manager tool:
Code Block 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:Code Block {"session":null,"test":null}
...
- Deploy the AUT to the application server.
- Extract the contents of the monitor.zip package you generated (see Generating Static Coverage with Jtest) to the server machine. The package contains the agent.sh/agent.bat script.
Run the agent.sh/agent.bat script to print the Jtest Java agent VM argument to the console:
Code Block 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"
- Add the
-javaagent
argument to the application server’s startup script. - Restart the server.
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:Code Block {"test":null,"session":null,"testCase":null}
Anchor | ||||
---|---|---|---|---|
|
...
Configuring CAM or
...
SOAtest
You need to configure the Parasoft product that you use for application testing. You can use either Coverage Agent Manager (CAM) or SOAtestYou can connect to either CAM or SOAtest to the Coverage Agent. CAM provides an interface for starting and stopping test sessions during manual test execution. Connecting SOAtest enables you to collect application coverage during automated functional test execution.
...
- If you use CAM, you need to configure CAM to connect to the Coverage Agent
...
- .
- If you use SOAtest, you need to configure SOAtest to:
- connect to the Coverage Agent.
- collect runtime coverage.
- merge runtime coverage with static coverage (see Step 1).
- upload the merged data to DTP.
Connecting CAM to the Coverage Agent
Open CAM Open CAM in a browser:
Code Block http://[your-Tomcat-host:port]/cam.
- Click Agents.
- Click Add Connection to configure the connection with the Coverage Agent.
Agent Name: Any user-friendly string that you want to display in CAM (for example, the name of the application).
Agent Address: The URL of the server where the Coverage Agent is attached to the AUT (see Step 2). The default port number for the Coverage Agent is 8050. - Click Test to verify the connection.
- Click Connect after successfully testing the connection.
Anchor | ||||
---|---|---|---|---|
|
...
and Enabling Coverage Upload to DTP
- Open SOAtest and go to Preferences> Reports> Coverage and specify the installation directory of dotTEST or Jtest.
- Configure a SOAtest test configuration
...
- Enable the Enable Test Execution option.
- Enable the Collect application coverage option.
- Specify the host or IP address of the AUT in the Coverage agent host field. The coverage agent should have been attached to the AUT in the previous step.
- Specify the port number for the coverage agent. The default number is 8050.
- If you are using multiple-user mode, specify an agent user ID, such as the current SOAtest username. This enables coverage to be associated with a specific user or client. Do not specify an agent user ID if the agent is not in multiple-user mode.
- Enable the Report coverage agent connection failures as test failures option if you want test failures reported when the coverage agent connection fails. If the option is disabled, connection problems will only be reported to the console.
- Enable the Retrieve coverage data and specify the where you want the store the dynamic coverage data in the Coverage data storage directory field.
- Enable Delete coverage data on retrieval option if you want the coverage data on the AUT to be deleted as soon as SOAtest retrieves it. We recommend enabling this option in order to prevent the taking up disk space on the coverage agent machine.
- to collect, merge, and upload application coverage data. You can configure an existing test configuration or create and configure a new one.
- Open the test configuration that you want to configure to collect application coverage data.
- Open the Execution> Application Coverage tab.
- Enable the Collect application coverage option and specify the host name or IP address where the application under test and coverage agent are hosted and the port number of the agent. The port number should match the value of the
jtest.agent.port
setting in the agent.properties file (default is8050
). You can click Test Connection to verify that SOAtest can communicate with the coverage agent. - (Optional) Under Coverage agent user ID, you can specify a user ID so that coverage results can be associated with a specific user. A user ID should only be specified when application coverage for multiple users is enabled for the coverage agent.
- Enable the Upload coverage report to DTP option to enable merging static and runtime coverage data and sending the merged coverage results to DTP.
- Configure the Static coverage file location option to specify the path to the static coverage file generated with dotTEST or Jtest in the .xml or .data format (see Step 1).
- Configure the Coverage image tags option to specify 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. For details, see the Parasoft DTP user guide at https://docs.parasoft.com.
- Enable the Report coverage agent connection failures as test failures option for test failures to be reported when the coverage agent connection fails, or when the static coverage file location is misconfigured. Otherwise, the problems will be reported to the console, but will not cause the test to fail.
- Click Apply to save your
...
- changes.
- (Optional) Save the test configuration to your workspace. This step makes running the configuration on the SOAtest command line more convenient:
- Right-click the new test configuration and choose Export.
- Save the test configuration to the SOAtest workspace.
In the next step, you will execute your tests using the new test configuration from the command line. But in order for DTP to associated the test results with the coverage information, you will need to create a properties file and specify the build ID used to create the static coverage filesettings required for DTP to properly match and display application coverage data.. The simplest way is to export the properties referenced by the SOAtest desktop.
- Choose Parasoft> Preferences from the SOAtest menu.
- Click the share link on the Parasoft page.
- Specify a name and location to export the settings file.
- Enable any settings you want to include in the file and click OK.
- Parasoft> Preferences from the SOAtest menu.
- Click the share link on the Parasoft page.
- Specify a name and location to export the settings file.
- Enable any settings you want to include in the file and click OK.
- Open the exported file and add the following properties:
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 merge SOAtest coverage results with results from other types of testing—such as unit testing and manual testing of the same application—they must all use the same build ID. The build ID set in this file must match the build ID set for dotTEST or Jtest when collecting static coverage.- dtp.project - Specifies the project on DTP with which you want to associate the coverage results. The DTP project set in this file must match the DTP project set for dotTEST or Jtest when collecting static coverage
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.
- Save the changes.
Step 4: Perform Testing Sessions
...
- Click Download Coverage to download the runtime_coverage_[timestamp].data file and note the location.
- Click Download Test Results to download the report.xml file and note the location.
Step 6: (CAM only) Upload the Test Results to DTP
Upload the report.xml file you downloaded from CAM to DTP. If you used SOAtest to execute your tests, the report will be saved in the location specified with the -report
flag. If you did not specify a location for the report, the file will be saved to the working directory. Uploading test results to DTP allows you to associate coverage data with individual tests and view the information on DTP.
- Go to Report Center in the DTP interface.
- Click the gear icon and choose Report Center Settings> Additional Settings> Data Collector Upload Form (requires admin permissions).
- Click Choose File and browse for the report.xml file you downloaded from CAM.
- Click the Upload button to upload the file to DTP.
Step 7: (CAM only) Merge the Static and Dynamic Coverage Data and Send to DTP
The static and dynamic coverage data must be merged into one coverage.xml file. To merge the coverage data and send the merged information to DTP, run dotTEST or Jtest with the following arguments:
...