Skip to main content
This content has been updated. Click here to continue your progress on the latest version.

Scenario testing

Industry best practices 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 and the lower the benefits.

ideal-test-pyramid

User interface-based functional and scenario tests

Use UI-based functional tests and end-to-end scenario tests to verify that end-to-end cases work as expected. The UI-based scenario testing tool allows developers to focus on creating functional and useful tests for single-page applications (SPAs) rather than writing complex code. Access to the scenario test feature is granted with the @baseclass pxScenarioTestAutomation privilege. This privilege is available with the out-of-the-box (OOTB) PegaRULES:SysAdm4 role.

Tests are saved in a dedicated test ruleset defined in the application rule. For more details on test rulesets, see the Pega Community article Creating a test ruleset to store test cases.

Once saved, tests are available on the Application: Scenario testing landing page. Navigate to the landing page from the header of Dev Studio by selecting Configure > Application > Quality > Automated Testing > Scenario Testing> Test Cases.

From the landing page, you can run a test, view the results of a previous test, and group functionally similar tests in test suites to provide organization. For more information on test suites, see the Pega Community article Grouping scenario tests into suites.

Scenario Testing landing Page

Scenario testing a feature on Pega Platform

Scenario testing allows you to create UI-based, end-to-end scenarios to test your application. The operator who has access to the runtime toolbar captures scenario tests in the context of the application portal.  From the Dev Studio application portal, use the Launch portal menu to select and navigate to the desired portal (such as the User Portalto initiate test recording. Use the Automation Recorder on the runtime toolbar to create or modify a scenario test.

scenario-recorder

Specify either a Case type or Portal scenario test when initiating the test recorder

Image of Create Test button
Note: Running scenario tests from Deployment Manager requires the use of a Selenium runner. For more information, refer to the Deployment Manager help on running Scenario Tasks. You can also run scenario tests from other pipeline tools using the associated Pega API. For more information, refer to the Pega RESTful API for remote execution of scenario tests discussion post.

Explicit assertions and scenario tests

Interactions are recorded in a visual series of steps and the execution of a test step can include a delay. When you use the automation recorder and hover over an element, the orange highlight box indicates a supported user interface element that you can test. The Mark for assertion icon on the orange highlight box provides two features: adding wait time following an action within the test scenario, and the ability to create validation steps in the test scenario. Each validation is executed while running the test scenario. The addition of wait times allows the application extra processing time when steps are expected to have slow response times. The wait time feature is essential to ensure that all the steps of a test script do not fail due to the slow response time of a single step.

runtime-scenario-testing

In the following image, click the + icons to learn more about the Automation Recorder capabilities.

Scenario test suites

From the Scenario Test landing page, you can run a test, view the results of a previous test run, and create scenario test suites. While editing a scenario test from the landing page, you can edit, add, and remove wait times and validations. Unlike Pega Unit tests, scenario test suites do not require predefined data pages and do not have the Setup & Cleanup tab for preparing data. To run a scenario test suite from the landing page, select the Test suites tab, select the check box for the test suite you wish to run, and click Run selected. The suite of scenario tests execute, and results are presented on the landing page.

Check your knowledge with the following interaction.

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

100% found this content useful

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice