Previous Topic Next topic Print topic


Running an Application with Code Coverage

Note: This facility is supported in native COBOL only.

Having enabled code coverage for a project, you need to execute the application with code coverage in order to generate the code coverage data.

There is a difference between how you run applications with code coverage depending on whether they require an enterprise server to run or not.

If your application does not require an enterprise server, to run it in code coverage mode:

  1. In COBOL Explorer, right-click your project and click Run > Run Configurations.
  2. Create a new COBOL Application configuration, or select an existing one.
  3. In the right side of the dialog box, click the Dynamic Analysis tab.
  4. Check Enable code coverage.
  5. Optionally, check Accumulate data from successive runs, if you want to preserve the previous results of running your application with test coverage.
  6. If necessary, specify names for the directories in your project that will contain the log files and the results files that are different than the default ones - Coverage and CoverageResults.
  7. Click Apply and then click Run to execute your application and create code coverage reports.

If your application requires an enterprise server, to run it in code coverage mode:

  1. In the IDE, ensure code coverage is enabled in your project's properties.
  2. Ensure that the enterprise server is configured to run in Code Coverage mode.

    See Enabling Code Coverage.

  3. Start the server from Server Explorer.

    You might be promoted to specify directories for the generated coverage files. Click OK to confirm your preferences.

  4. Execute your application in the usual manner.
  5. Stop the server in Server Explorer.

    You must stop the server for the IDE to produce the Code Coverage report files.

Viewing the Code Coverage reports

If there are no code coverage report options checked in the IDE preferences, running with code coverage only produces a binary results file, filename.tcz, in the directory specified on the launch configuration. In this case, to produce the code coverage report files in .html format, right-click the filename.tcz file in your project and click Generate Coverage Report.

If Generate reports upon run completion is checked in the IDE preferences for code coverage, when the application finishes running, the IDE displays Code Coverage Report Generation Options dialog box for you to specify options for producing the report.

Previous Topic Next topic Print topic