As an application developer, capture the test coverage of your Pega Platform™ application. Test coverage metric can be used to understand if there are enough tests in the application to ensure that all the rules of the application run when a developer or their team performs the test. During the testing session of an application, the test coverage feature provides information about the rules that are covered (hit) and not covered (not hit) in that testing session.
As a simple exercise, run a unit test case of one of the rules of your Pega Platform application to capture the Test coverage metrics of the application.
- Capture the test coverage by running a test case in a test coverage session.
- Generate and then analyze the coverage report to see the details of the covered and uncovered rules.
The following table provides the credentials you need to complete the challenge:
Note: Your practice environment may support the completion of multiple challenges. As a result, the configuration shown in the challenge walkthrough may not match your environment exactly.
1 Capture test coverage by running a unit test case
- Log in to Dev Studio as the Application Developer:
- In the User name field, enter pgpTester.
- In the Password field, enter rules123!.
- In the header of Dev Studio, click Configure > Application > Quality > Test Coverage to create a new unit test case.
- Click the Application level tab.
- Click Start new session to display the Start coverage dialog box.
- In the Title field, enter ChallengeExercise, and then click OK to close the dialog box.
The Application level coverage is in progress message is displayed that indicates the new application-level coverage session started successfully.
- In the header of Dev Studio, click Configure > Application > Quality > Automated testing > Unit testing > Test cases to run a unit test case to capture the test coverage.
- On the Application: Unit testing landing page, filter the Rule name column to display two rules: Update Experience and Associate business.
- Select the ActivityStatus checkbox, and then click Run selected to run the test case.
- After the test case run is completed, on the Application: Unit testing landing page, click Stop coverage to generate the report.
2 Generate and analyze the coverage report
- In the results of the coverage session, in the Coverage history section, click Show report to access the coverage report data.
- On the Covered tab, confirm that the UpdateExperience rule is displayed.
- On the Uncovered tab, confirm that the rule for which you did not run a unit test case, AssociateBusiness, is displayed.
Tip: You can use the coverage feature for the entire application. You can run all the test cases for various rules during a test coverage session. As a result, the autogenerated report displays details of all rules that are covered and the rules that are yet to be covered.