
Test coverage
Industry best practice for test automation
Industry best practices for test automation are graphically shown as an Ideal Test Pyramid. Test types at the bottom of the pyramid, such as unit testing, are the least expensive to run, easiest to maintain, take the least amount of time to run, and usually represent the greatest number of tests in the test suite. Test types at the top of the pyramid, such as scenario testing, are the most expensive to run, hardest to maintain, take the most time to run, and should represent the least number of tests in the test suite. The higher up the pyramid you go, the higher the overall cost.
With built-in tools, Pega Platform™ helps developers ensure that tests in their test suite cover the most rules in their application regardless of type.
The Test coverage tool
The Test coverage tool determines how many rules are covered in your application's various test suites. An uncovered rule is a rule that is not tested by a Pega Platform test. The tool provides a Test Coverage Report that shows how many and which rules in your application are covered and not covered by tests. You can use this data to analyze changes in test coverage and verify which rules require testing.
You can generate two types of test coverage reports:
- User-level test coverage reports identify which executable rules in your currently included applications are covered and not covered by tests.
- Application-level coverage reports contain test coverage results from multiple users.
While both reports identify which executable rules in your currently included applications are covered and not covered by tests, only application-level coverage reports contain results from multiple users.
Note: Results from application-level coverage reports are visible in the Application Quality Dashboard in Dev Studio. Results from user-level test coverage reports are visible in the Coverage history section.
In the following image, click the + icons to explore the Test Coverage Report.
Test coverage session configuration
To begin a test coverage session, the system first needs to know which application to measure test coverage. You can ensure that your current application is reflected in the Application Quality Settings page in Dev Studio by clicking Configure > Application > Quality > Settings. Tested applications can be independently built on the same application or built on top of each other.
User role requirements
Because test coverage sessions are associated with a particular user, certain configuration requirements must be met before a test coverage session can begin:
- A user needs the role SysAdm4 to run test suites.
- Only users with either the SysAdm4 or User4 role can contribute data for test coverage. For example, if another user who does not have the SysAdm4 or User4 role runs a test, it does not count towards rule test coverage.
- Only users with the pzStartOrStopMasterAppRuleCoverage privilege can initiate application-level coverage.
Application-level test report merges
When an application-level test coverage session is running, multiple users who have the SysAdm4 or User4 role can perform tests to contribute to the coverage report. Because multiple users are contributing to test coverage, the system records each test instance as a separate test report. To consolidate data, you can generate a single consolidated test coverage report by merging multiple application-level test coverage reports.
You navigate to the test coverage page in Dev Studio by clicking Configure > Application > Quality> Test Coverage to merge application-level test reports. In the Coverage history section, you can review the titles, dates, and coverage statistics of reports, and then click Merge reports to consolidate testing.
Note: Only the latest application-level test report of each application in the system is displayed for selection when you click Merge reports.
Check your knowledge with the following interaction.
If you are having problems with your training, please review the Pega Academy Support FAQs.
Want to help us improve this content?