Discussion
coforge
IN
Last activity: 11 Dec 2019 2:42 EST
Test coverage feature for CaseType using PegaUnits
Test coverage is a feature to measure the percentage of rules covered from application testing.
Ex:- Percentage of rules covered from Manual testing, UI automated tests and PegaUnit tests.
There are two types of test coverage, 1) Application level 2) User level
Application level test coverage allows to capture coverage from multiple login sessions and collates them.
User level test coverage is for specific user session.
This post talks about capturing and measuring the test coverage of a case type using PegaUnit automation.
Let us take the use case of an application which has a case type called "Feedback". This case type is used by multiple stakeholders who use the application and provide their feedback on the application. Once Feedback case is created, team tries to address the feedback in multiple ways by creating a "user story", "Issue", "Bug" or if it is big enhancement then by EPIC. Finally, once this feedback is resolved, the status of the case type is changed to "Resolved-Addressed".
Now, let us see how this case type and its supporting rules can be automated using PegaUnit and how Test Coverage feature can be leveraged to understand the gaps in automation.
Step 1: Create a PegaUnit for the "Feedback" case type.
Please follow the link to create a PegaUnit for our case type https://community.pega.com/knowledgebase/articles/devops-release-pipeline-overview/pega-unit-test-cases-flows-and-case-types
During creation of PegaUnit, followed the above stages in Feedback case type and resoled case type with a status "Resolved-Addressed".
Assertion for the same status is added to below PegaUnit. We would like to run this PegaUnit during the coverage session.
Step 2: Find the list of rules under the Case Type class from App Explorer. Create PegaUnits for individual rules to validate the functionality or logic in these individual rules. PegaUnits can be created for different rule types, like Data Transforms, Decision Rules, Activities etc.,
Step 3: Start the application coverage by navigating through Configure menu of Dev studio.
Open Configure->Application->Quality->Test Coverage landing page.
Once landed, start the application coverage. Click on "Start new session" and provide the description of the coverage and click "ok" to start coverage.
Once application coverage is started, confirmation is shown on screen as below and tests can be executed as the TestCoverage capturing keeps happening in the background if any tests are executed.
Step 4: After running the PegaUnits, go to the coverage landing page again and stop the coverage.
Configure->Application->Quality->Test Coverage.
Click on "Stop Coverage" in the landing page header.
Once the coverage is stopped, a coverage report will be generated, and it will be shown in the list of coverage records.
Step 5: To check the coverage of the case type named "Feedback", go to application quality dashboard. A tab named “Case type” would be found, there "Test coverage" percentage of “Feedback” case type can be identified.
Configure->Application->Quality->Dashboard
Click on the refresh, to ensure the application quality dashboard is presented with the latest application coverage details.
Below is the screen shot we can expect to see
We can see the coverage of the case type “Feedback” as 15%. This is achieved through PegaUnit written. We can click on "View details" to see more details about coverage.
Above reports on Application Quality Dashboard can be leveraged to find out the gaps in unit testing and in turn building more automation to ensure the quality of the application.