Setting acceptable levels of code coverage preconditions for code delivery

You can set a threshold for acceptable code coverage results before the code can be checked in to Rational Team Concert™.

Before you begin

To perform this task:
  • Your Rational Team Concert user ID must be in the JazzAdmins repository group.
  • Rational Team Concert Client must be installed on your workbench.

About this task

You can enforce the quality of code by controlling a threshold that the code coverage of classes needs to meet before they can be delivered to a stream. In the event a class fails to meet the threshold that you set, the user attempting to check in the class is shown the which type of code coverage level is not acceptable.

Procedure

  1. Open the Project Area that you want to modify. In the Team Artifacts view, right-click the project area.
  2. Click the Process Configuration tab.
  3. Click Team Configuration > Operation Behavior.
  4. In the Operations column of the Operation Behavior table, go to Source Control.
  5. In the Deliver (client) row, select the cell for the role to which you want to apply the precondition. For example, select Everyone.
  6. Select Preconditions and follow-up actions are configured for this operation.
  7. In the Preconditions list, click Add and select Prohibit Unsatisfactory Code Coverage.
  8. Select Fail if not installed.
  9. Set the acceptable code coverage levels.
  10. Optional: Add any classes that you want to exclude from the code coverage requirement.
  11. Optional: To apply the code coverage requirement to a specific list of classes, under Choose Components click Add and enter component that you want to exclude.

Results

If a user attempts to deliver code that does not meet the code coverage levels that you specified, then the delivery will fail. The Team Advisor view will list the file that was not delivered and the methods that did not meet the code coverage requirements.
Image of Team Advisor view showing delivery failure of a file that did not meet code coverage requirements.

Feedback