Workflows for remote formatting code coverage

z/TPF scriptable code coverage support externalizes several REST services for you to test connectivity among different components, collect code coverage data, and check the status of code coverage processing. You also need a viewing tool to view and analyze the collected code coverage data.

  1. Optional: Test connectivity

    An optional REST service is provided for you to test the connectivity between your regression test framework, the z/TPF system, and Linux® on IBM Z®. You can call this service before you start the regression test and code coverage collection.

    1. You send the connectivity service request from the regression test framework to the z/TPF system.
    2. The z/TPF system sends a service request to Linux on IBM Z to verify the connectivity to the Tomcat server and the availability of required services.
    3. The z/TPF system returns a success or error code to the regression test framework:
      • If a success code is returned, you can start the regression test and code coverage collection.
      • If an error code is returned, resolve the error, and restart the test.
    Figure 1. Test connectivity
    Alternate text
  2. Collect code coverage data

    A set of tests loop through the regression test framework. Each test goes through the following procedures:

    1. You send a REST service request from the regression test framework to the z/TPF system to start code coverage collection on the z/TPF system.
      Note: If you want to manually check whether a registration entry was created successfully, enter the ZDBUG CODECOVERAGE command with the DISPLAY parameter specified on the z/TPF system.
    2. If the request is successful, code coverage data collection begins on the z/TPF system when you run the programs that you specified in your start request.
    3. You send a REST service request from the regression test framework to the z/TPF system to stop code coverage collection. You can specify in your request whether to include source code in code coverage collection.
    4. If the request is successful, the z/TPF system sends the code coverage results, which are in the binary format, to Linux on IBM Z for further processing. If you want to start another code coverage collection on a previously collected program, you can call the start service now.
    5. The scriptable code coverage convert web application, which resides on Linux on IBM Z, converts the data from the binary format into a format that is consumable by TPF Toolkit 4.6 or later or a format that is consumable by SonarQube. You can specify the format of the results on a format parameter of the REST API that you use to stop code coverage collection.

      If you configured the stop service request to include source code in code coverage collection, the web application also collects the source files for the programs that are requested in code coverage collection. The converted data and the source code are stored in a directory on Linux on IBM Z that is accessible by a viewing tool to read the code coverage data for display and analysis. You need to specify this directory on a parameter of the REST API that you use to stop code coverage collection.

    Figure 2. Collect code coverage data
    Alternate text
  3. Optional: Verify the status of code coverage processing

    Before you can safely deactivate the z/TPF system, you need to ensure that there is no in-progress code coverage processing on the z/TPF system or Linux on IBM Z. An optional REST service is provided for you to verify whether code coverage processing is completed and all data has been transferred to Linux on IBM Z.

    You send a REST service request from the regression test framework to the z/TPF system to check the status of code coverage processing. If the request is successful, the service returns a status code to indicate whether there are in-progress code coverage activities on the z/TPF system or Linux on IBM Z. If there are no in-progress code coverage activities, you can safely deactivate the z/TPF system.

    Figure 3. Verify code coverage status
    Alternate text
  4. View and analyze code coverage results

For more information about the REST APIs that are used in this support, see Scriptable code coverage services in REST API reference.