Setting code coverage acceptance levels

You can specify code coverage acceptance levels for one or more of the following elements: program, module, source file, and procedure. All criteria must be met in order for the program to be flagged as passing the code coverage requirements.

About this task

When you set code coverage levels, the level that you enter is the minimal acceptable percentage of code coverage. You can set acceptable code coverage levels for one or more of the following elements:
  • Program
  • Module
  • Source file
  • Procedure
By default, a code coverage result uses a module threshold of 80% as its only acceptance criterion.
Note: Changing the threshold criteria for your code coverage results, results in the status column in the Code Coverage Results view being updated.

Procedure

To customize the code coverage acceptance levels or thresholds:
  1. Select Window > Preferences.
  2. Select Run/Debug > Compiled Debug > Code Coverage.
  3. Specify the minimum acceptable percentage of code coverage for one or more of the following elements:
    • Program: the percentage of lines that must be covered in a program in order to meet the acceptance criteria.
    • Module: the percentage of lines that must be covered in the module in order to meet the acceptance criteria.
    • Source file: the percentage of lines that must be covered in the source file in order to meet the acceptance criteria.
    • Procedure: the percentage of lines that must be covered in a procedure in order to meet the acceptance criteria.
    Use the check boxes, to select the desired elements. Enter the minimum acceptable code coverage percentages in the associated box for each element selected.

  4. Click the OK button.
  5. To restore the default acceptance criteria for a code coverage result, open the code coverage preferences page and click Restore Defaults . The module threshold level will be reset to 80% and all other threshold levels will be deselected.

Note that all criteria must be met in order for the program to be flagged as passing the code coverage requirements. An icon will appear in the Compiled Code Coverage Results view indicating whether the acceptance criteria passed or failed. Additionally, each failed element is decorated in the report view with a red "x" overlay. For example, in the following report, the selected item is marked with a red "x" because it did not meet the threshold requirement.


Feedback