End-to-end testing using Pega software
End-to-end testing helps test an application from end to end. This type of testing simulates real user scenarios and validates the system being tested and its components for integration and data integrity.
Pega offers a Scenario testing framework and a selenium starter kit to support End-to-end testing of Pega applications that use the application UI. Pega supplies the Scenario testing framework out of the box at no additional licensing cost.
Using the Pega Scenario testing framework, users can create UI-based scenario tests without writing script or code. This framework works on the record and playback mechanism. Users can run test cases created using this framework manually or in an automated fashion using a test suite or from a Continuous Integration (CI) pipeline.
The following list contains the key features of the Scenario testing framework:
- Create tests using the application UI
- Add and remove validations
- Edit, add, and remove test steps
- Configure delays
- Set up and clean up test data
- Supply dynamic test data
- Manage tests
- View key metrics
- Integrate with CI/CD
Create tests using the application UI
Using the Scenario testing framework, users can create two types of Scenario test cases from the application UI:
- Case type: Creates a scenario test case for the end-to-end flow of any specific case type of the application.
- Portal: Creates a scenario test case for any specific interaction portal by performing all possible actions and navigations on the portal.
Add and remove validations
For every action which the users perform on the screen while recording a test case for a case type flow or on the Interaction portal, an implicit validation gets added in the Scenario test automatically. Users can remove these validations if they do not need them for validation. Apart from these implicit validations, users can add explicit validations on various UI controls on each screen.
Edit, add, and remove test steps
When modifying a Scenario test case, users can perform the following operations:
- Edit steps: Click a step and modify the content of the step, for example, values or validations.
- Remove steps: Remove an unwanted step by going to a step and removing it manually.
- Insert steps: Add one or more steps between two steps.
- Rerecord the test from a particular step: Discard the test case steps following a particular step and record a new flow from that point.
Users can configure delays for some or all steps of a Scenario test case to handle issues, such as UI rendering and environmental slowness. Scenario testing framework enables users to configure the following two types of delays for a Scenario test case:
- Step level: Users can configure a delay at the step level of a Scenario test case. After a user configures the delay, the step waits for the specified amount of time before running the step. This setting is helpful when certain steps run multiple transactions and load UI objects which take more time.
- Application level: Users can configure a delay at an application level on the application quality settings page. This setting applies to each step of every test case in the application. It is especially helpful to handle slow environments.
Set up and clean up test data
The ability to set up and clean up the test data is important for any test framework. It enables users to create tests that are environment-independent. With this ability, users can make a test independent to run, which avoids errors that might arise due to dependencies.
- Using the Setup section of the Scenario test case, users can set prerequisite data that is required for the rule under the test to run independently.
- Using the Cleanup section of the Scenario test case, users can choose whether to perform an automatic test data clean-up at the end of the test. Additionally, this section also enables you to create steps that are necessary to clean any test data manually. It is the final step of a test case.
Supply dynamic test data
Users can provide either static (hard-coded) or dynamic data reference for validations in a Scenario test case. Using the Setup section of the test case, users can create pages and record values on pages, which properties can reference dynamically from the test case.
For example, users create a transaction on an existing account, they cannot always have the same account among environments. In such a case, users choose the Setup section of the test case to create an account and keep the account data on a temporary page. Users can now refer to the account data from the test case to create and validate transactions. It avoids dependencies for running scenario tests.
The Scenario testing framework has landing pages in the Dev Studio and on the portal, to manage the Scenario test cases of an application.
From the Dev Studio, users can view, run, and edit the test cases. However, they cannot record test cases.
From the Interaction Portal, you cannot record, view, run, or edit test cases.
View key metrics
The Scenario testing framework offers the following two key metrics regarding test cases:
- Test execution summary: Shows the test execution metrics for case type and portal types of tests.
- Test execution metrics for each case type and portal: Shows the test execution metrics at each case type and portal level
Integrate with CI/CD
Run end-to-end test scenarios in stages, such as quality assurance and staging, in which users might want to perform only acceptance testing, but not all regression testing. The scenario-testing framework allows the Pega APIs (/pegaunits/execute and /pegaunits/execute()ID/results) to execute Scenario test cases in the pipeline.
The following image shows the PegaUnit framework that offers the /pegaunits/execute and /pegaunits/execute()ID/results API to run the application test cases from a remote location:
By using Deployment Manager, users can make use of a built-in task to execute Scenario test cases, similar to the PegaUnit test case run task.
Check your knowledge with the following interactions:
Selenium starter kit
Pega provides Selenium-based UI test frameworks and sample UI tests that users can leverage to build test cases for Pega applications. With this test framework, users gain the following benefits:
- Skip writing infrastructure code
- Take advantage of built-in diagnostics and testing capabilities
- Focus on the most important thing, testing the Pega application
The starter kit comes with a generic, selenium-based UI test framework for creating UI page objects and UI tests for Pega applications. The kit also includes the following items:
- Sample UI test framework to support testing core Pega CRM applications – Pega Sales Automation, Pega Customer Services, and Pega Customer Decision Hub (formerly Pega Marketing)
- Out-of-the-box (OOTB) sample tests to validate real core use cases of the CRM applications. Users can refer to the kit when creating an application with specific UI page objects and end-to-end UI test scripts. The framework and tests are behavior-driven development (BDD) based and leverage the Cucumber framework.
The Selenium starter kit offers the following key features:
- Support for core Pega CRM applications:
- Pega Sales Automation
- Pega Customer Service
- Customer Decision Hub
- Web driver abstraction
- Ability to run on remote web driver
- Page objects specific to core Pega CRM applications
- Diagnostics and test tools for easy debugging
- Sample out-of-the-box (OOTB) Cucumber-based tests for core Pega CRM applications
- Step-by-step guidelines on getting `started, and to run and write UI tests
- Test results and reporting
- Support to run the test from a Gherkin file directly (Run as > Cucumber feature)
- Test Results and Reporting using cucumber extent reports
Check your knowledge with the following interaction: