Running the Test Under Code Coverage

To produce code coverage statistics during the test run, you must first compile the source application (the project that contains the code to be tested) with code coverage enabled.

  1. In the Solution Explorer pane, expand the AirportLinkLibrary project, then double-click Properties.

    The project properties appear.

  2. Click the COBOL tab.
  3. On the COBOL pane, select Enable code coverage, then press Ctrl+S to save the changes.
  4. In the Solution Explorer pane, right-click the AirportLinkLibrary project, then click Rebuild.

    The project is rebuilt with code coverage enabled.

  5. In the Micro Focus Unit Testing window, click Run All (Code Coverage).

    The TESTAIRCODE test case is re-run and on completion code coverage statistics are displayed in the Micro Focus Code Coverage window.

  6. Expand the nodes as shown below, to show the sections of the source code that were executed during the test run:

    Notice that the Section: distance-between-airports entry is showing 0% covered.

  7. Double-click the Section: distance-between-airports entry.

    The cursor is positioned in the source code at the distance-between-airports section, and the source code is colorized (according to your editor preferences) to indicate that it was not executed. Later in the tutorial, we will view this section again when the code has been executed. For more information on Code Coverage, refer to Code Coverage (Native COBOL).