Unit Test configuration and run options
The Unit Test feature mimics your project structure by grouping all test cases associated with a particular automation into the application folder. In the Unit Tests Explorer, click the automation parent folder to see the Automation Overview, which contains the summary of the associated test cases, as well as the test run options. The Automation Overview enables you to run all the test cases associated with the automation by clicking the button, as shown in the following figure:
Setup and cleanup tab on the automation level
The automation containing the test cases behaves as a test suite. Pega Robot Studio enables you to define the setup and cleanup tasks that apply to all test cases that fall under that automation in the tree structure. To access the run options, open the Setup & cleanup tab in the Automation Overview.
The Setup & cleanup tab contains two sections, which give you different options to prepare the system for running unit test suites, depending on your scenario. In the following image, click the + icons to learn more about the Setup & cleanup configurations:
Single test case run options
Some tests in a test suite might require specific configurations to be performed before or after the test run. For example, an insurance company tests an automation that fills in an insurance claim. Most of the tests verify scenarios where the claim contains an error, and the automation fails to advance to the next view in the application. However, there is one test that fills in the form correctly, and the application moves to the claim confirmation view. This can cause another test in the batch to fail, due to the unexpected application state. To address this issue, the developer should set up a cleanup automation that brings the system back to the claim form.
To access the single test configuration, select the test in the Unit Test Explorer, and then open the Setup & cleanup tab, as shown in the following figure:
Unit test property grid
When creating a unit test, use the property grid to provide a detailed description of each test case and access batch run options. To access the property grid, select the test case in the Unit Test Explorer, and click the arrow in the upper-right corner of Pega Robot Studio, as shown in the following figure:
In the Basic details section, you can provide additional information about the test case to help interpret the test results. It is important to give each test case a descriptive name so that it is easy to identify when debugging the project.
The Batch execution options section provides options for configuring the behavior of the test case in the test suite. Use the Include in batch property parameter to decide whether the test case will run every time the whole test suite runs. You can also choose to ignore the test results temporarily, for example, if you are developing your automation. Additionally, you can select the environment you want to run your test on by changing the Environments property.
Test result summary
In the test case view, you can access the Results tab to get more information about each test run. If an exception occurs during the test run, you can check the details by selecting the test case, and reading the Message section in the test result summary, as shown in the following figure:
Check your knowledge with the following interaction:
This Topic is available in the following Module:
Want to help us improve this content?