CreatingUnitTests_Start.zip
(60.39 KB)
Creating Unit Tests in Pega Robot Studio
4 Tasks
10 mins
Pega Robotic Automation 22.1
Beginner
Robotic Process Automation
English
Scenario
You are a member of the development team responsible for preparing Application Assets for the BankerInsight application. Your current task is to develop Unit Tests for the customerSearch method.
Complete the following tasks:
- Create the 01_CustomerSearch_CustomerNotFound Unit Test using the Convert to unit test option.
- Create the 02_CustomerSearch_CustomerFound Unit Test using the Unit Test Explorer.
- Create Setup and cleanup automations for newly created unit tests.
- Configure Setup and cleanup automations for the test suite.
Detailed Tasks
1 Create the customerNotFound unit test using the Convert to unit test option
- Download and unpack the folder containing the CreatingUnitTest_Start zip file and move it to
C:\Users\<username>\Documents\Pega Robot Studio\ - Open CreatingUnitTest_Start.pegaProject in Pega Robot Studio.
- In the Project Explorer, click and open the BankerInsight application tab.
- Update the Path field of the BankerInsight app to the location of the application on your local computer.
Note: If you don't have the BankerInsght application installed on your computer, you can download it from the Sample application folder located in your Pega Robot Studio installation path.
- In the Project Explorer, open the BankerInsight folder and then open the Login method.
- In the upper-right corner of Pega Robot Studio, click to open the Testing automation dialog box.
- In the username and password fields enter pega, and then click .
- In the Test result dialog box click to finish the test.
Verify that the BankerInsight application is running and displays the Client Details pane. - In the Project Explorer, open the CustomerSearch method.
- In the upper-right corner of Pega Robot Studio, click to open the Testing automation dialog box.
- In the Testing automation dialog box, in the customerNumber field, enter 111000, and then click .
- In the Test results dialog box, click to create a new test using the current test run.
- In the Add new test case dialog box, in the Test case name, enter 01_CustomerSearch_CustomerNotFound and then click .
- On the Unit tests tab toolbar, click .
2 Create the customerFound unit test using the Unit Test Explorer
- In the Test Explorer select CustomerSearch to open the Automation Overview.
- On the Automation Overview, click .
- In the Add new test case dialog box, in the Test case name field, enter 02_CustomerSearch_CustomerFound, and then click .
- In the Unit Test Explorer, in the Inputs section, enter 40932 in the customerNumber field.
- In the Outcome conditions section click to create a first condition.
- In the Outcome conditions section, click the icon to add another condition.
- In the Field drop-down list select Result, and in the Expected value drop-down list select True.
- On the toolbar click .
3 Create Setup & cleanup automations
- In the Project Explorer, right-click the Unit test folder, and then click Add > Automation.
- In the Add new automation dialog box, in the Automation name field, enter Setup_CustomerSearch, and then click .
- On the automation surface, add an Entry and Exit point with no parameters.
- On the toolbar, click to open the Include in palette dialog box.
- In the dialog box, click the Application tab, click the button next to the BankerInsight application, and then click .
- On the palette, expand the Applications section, and then drag the BankerInsight application to the automation surface to open the Select action dialog box.
- In the dialog box, click the Method tab, select the StartApp method, and then click .
- On the Palette, drag the BankerInsight to the automation surface.
- In the Select action dialog box, select the Login method, and then click .
- In the Login design block, click the username parameter, and then enter pega.
- In the Login design block, click the password parameter, and then enter pega.
- On the automation surface, connect the design blocks as shown in the following figure:
- Repeat steps 1-5 to add a Cleanup_CustomerSearch automation with Entry and Exit points to the Unit Test folder.
- On the Palette, expand the Application section, and then drag the BankerInsight control to the automation surface.
- In the Select action dialog box, in the Method tab, select StopApp, and then click .
- On the automation surface, connect the design blocks as shown in the following figure:
- On the toolbar, click Save all to save the project.
4 Configure Setup and Cleanup applications for the CustomerSearch test suite
- On the Unit tests tab, expand CreatingUnitTests_Start > BankerInsight, and then select the CustomerSearch automation to display the Automation Overview.
- In the automation pane, click the Setup & cleanup tab.
- In the Configuration for test case section, in The setup automation to run once before execution drop-down list, select Setup_CustomerSearch.
- In The cleanup automation to run once after execution drop-down list, select Cleanup_CustomerSearch.
- On the toolbar, click Save all tests.
This Challenge is to practice what you learned in the following Module:
If you are having problems with your training, please review the Pega Academy Support FAQs.
Want to help us improve this content?