Skip to main content

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 Run tests button, as shown in the following figure: 

The Automation Overview of the Unit Test feature showing the test suite results. The run tests button on the upper-right corner allows for running all tests in the suite.
Note: Test cases are run in the order they are listed on the Unit Test Explorer. If the order is important, prefix the test case names with numbers when creating Unit Tests. 

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.

Note: You can configure setup and cleanup tasks on the automation or test case level. For more information about the relationship between these levels, see Define before and after tasks

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:

Note: To use automations for the Setup and cleanup section, add them to the Unit Tests folder of the Project Explorer

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: 

The setup and cleanup tab of the single unit test.
Note: Use the Setup & Cleanup tab on the Test Case level only in case you have a configuration that is specific to one particular test case.  

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: 

The unit test property grid with an arrow in the upper-right corner used to show and hide the grid.

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: 

The test result summary of a single test case.

Check your knowledge with the following interaction:

 


This Topic is available in the following Module:

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

Did you find this content helpful?

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