Skip to main content

Testing your application

4 Tasks

40 mins

Visible to: All users
Beginner Pega Platform 8.7 DevOps English
Verify the version tags to ensure you are consuming the intended content or, complete the latest version.


For an Assistance Request case, when users enter the vehicle make, one or more associated models are displayed in the Model drop-down list. Intermittently, users report that during the Submit request process, some car makes do not have an associated model name in the drop-down list when entering the vehicle information. Stakeholders need to easily identify the vehicle makes with at least one associated model.

Additionally, stakeholders are concerned about application performance. To ensure that customers can complete Assistance Request cases efficiently, stakeholders require that the vehicle model list is generated within 200 milliseconds and that the user interface and end-to-end process flow functions correctly.

To meet these requirements, your deployments manager has asked you to:

  • Create a unit test to test the vehicle model list and confirm the model list generates in the time threshold.
  • Create a scenario test to automate testing for the Assistance Request case type.
  • Run a Test Coverage session using the unit test and scenario test and report the results. 

The following table provides the credentials you need to complete the challenge.

Role User name Password
Application Developer tester@gogoroad pega123!
Note: Your practice environment may support the completion of multiple challenges. As a result, the configuration shown in the challenge walkthrough may not match your environment exactly.

You must initiate your own Pega instance to complete this Challenge.

Initialization may take up to 5 minutes so please be patient.

Challenge Walkthrough

Detailed Tasks

1 Run the List Vehicle models data page and test different Make values

  1. In the navigation pane of Dev Studio, click Data types to open the Data Explorer.
  2. Expand Vehicle models, and then click List Vehicle models to edit the D_VehiclemodelsList data page.
    The Data types explorer, with the Vehicle models data type expanded and the List Vehicle models data page selected.
    Note: If the List Vehicle models data page is not displayed in the Data Explorer, click Options > Refresh to refresh the explorer.
  3. In the upper right, click Actions > Run. The Run Data Page window is displayed.
  4. For the make parameter, in the Value field, enter Tesla as the test value.
  5. For the modelyear parameter, in the Value field, enter 2017 as the test value.
  6. In the upper right, click Run to test the data page.
  7. Expand the pxResults property and confirm that the property includes three results pages.
    A successful unit test of the List Vehicle models data page, with three results returned.
  8. For the make parameter, in the Value field, enter Saturn, and then click Run. The pxResults property is no longer displayed, which confirms that not all vehicle makes have at least one associated model.

    A completed unit test of the List Vehicle models data page, with no results returned.

2 Create a unit test

  1. In the Run Data Page window, for the make parameter, in the Value field, enter Tesla.
  2. For the modelyear parameter, in the Value field, enter 2017.
  3. In the upper right, click Run. The Convert to test button is displayed.
  4. Click Convert to test to close the Run Data Page window and create a test case record for the data page that uses your test results.
    The Convert to test button, which creates a test case from a successful unit test result.
    Note: The parameter values entered in the Run Data Page window are automatically populated in Edit Test Case.
    A unit test record, with the parameters to the tested rule highlighted.
  5. In Edit Test Case, in the Expected results section, verify that the Assertion type list value is Expected run time.
  6. In the Value field, enter 0.2 to set the passing threshold for the unit test to 0.2 seconds.
    Unit test expected run time 0.2 seconds
  7. In the second Assertion type list, select Result count
  8. In the of object field, enter or select .pxResults.
  9. In the Comparator list, select is greater than.
  10. In the Value field, enter 0. The unit test validates that at least 1 record is returned from the data page when the Make parameter value is Tesla.
    Assertion type
  11. Click Save.
  12. In the Label field, enter VehicleModelsList_Tesla to name the test case record.
  13. In the Add to ruleset and version lists, verify that the highest ruleset version is selected.
    The Test Case Record configuration form, filled out to create a test case.
  14. Click Submit to create the unit test.

3 Create unit tests for different vehicle makes

  1. In the VehicleModelsList_Tesla test case, to the right of Save, click the down arrow
    Save down arrow
  2. Click Save as.
  3. In the Label field, enter VehicleModelsList_Ford.
  4. Click Create and open to save a copy of the test case.
  5. To the right of Class, click the Gear icon to open the Edit details window and update the rule parameters.
    A unit test case record with the gear icon highlighted, indicating where to click to change the test parameters.
  6. In the Parameter(s) sent section, in the make field, enter Ford.
    Changing the value of the make parameter from Tesla to Ford.
  7. Click Submit to close the Edit details window.
  8. In the Description section, click the Edit icon to edit the vehicle make.
  9. In the parameters area, enter Ford to replace the Tesla value for <make: Tesla>
  10. Click Save to complete the configuration of the unit test. 
  11. Repeat steps 1-10 to use VehicleModelsList_Saturn as the test case label and Saturn as the make parameter.

4 Record a new scenario test case

  1. In the header of Dev Studio, click Launch Portal > User Portal to open a new browser tab or window with the user view of the GoGoRoad application.
  2. In the lower right of the screen, click the Runtime toolbar icon, and then click the Automation Recorder icon to open the Scenario tests pane. 
    Scenario testing recorder
  3. In the Scenario tests pane, click Create test case > Case type > Assistant Request to begin recording your actions on a case type.

    Screenshot showing how to start recording a test
  4. In the Create view, in the How can we help you today? list, select My vehicle has a flat tire.

    Note: An orange border is displayed around all objects you interact with to indicate that the Automation Recorder tool is recording the actions you take in this scenario. In the contextual pane, the actions you perform are recorded in the order in which you perform them.
  5. Click Continue to advance to the Enter customer information form.

  6. In the Enter customer information form, in the Account ID list, select [email protected].
  7. Click Continue.
  8. Complete all fields on the Identify location and Identify vehicle forms.
  9. In the Scenario tests pane, click Stop and save test case to stop recording your actions. 
    Actions taken
  10. In the New test case pane, enter or verify the following information:
    Field or drop-down Value
    Name Initial Customer Request
    Description Initial Customer Request
    Apply to GoGo-GoGoRoad-Work-AssistanceRequest
    Add to ruleset GoGoRoadTC:01-01-01
  11. Click Save to save the new scenario test case.

  12. In the lower-left corner, click the User icon > Log off to log out of the User Portal and return to Dev Studio.

Confirm your work

Specify the application for Test coverage data capture

  1. On  the Configure menu, click Application > Quality > Settings 
  2. Click Include built-on applications, and then select GoGoRoad to include the application for Test coverage.
  3. Click Save.

Start a new Test Coverage session

  1. Click Configure > Application > Quality > Test Coverage to open the Test coverage screen. 
  2. Click Start new session
  3. In the Title field, enter Session1 for the name of the session.
  4. Click OK to begin the Test coverage session.

Run the Unit test

  1. On the Configure menu, click Application > Quality > Automated testing > Unit testing > Test cases to display all the unit tests that you created for the GoGoRoad application.
  2. To the left of the Test case name column, select the check box to select all the test cases.
  3. Click Run selected to execute the unit tests.
  4. In the Result column verify that the Tesla and Ford unit test cases passed and the Saturn unit test case failed.
  5. To the right of Failed, click View to see additional information and investigate why the Saturn test case failed. The Test Runs Log dialog box is displayed.
  6. Click the test result to show the test results for VehicleModelsList_Saturn.

Run the scenario test

  1. In the header of Dev Studio, click Configure > Application > Quality > Automated testing > Scenario testing > Test cases to view the list of test cases for the application. 
  2. In the Scenario testing view, select the Initial Customer Request checkbox.
  3. Click Run selected to execute the test.
    A dialog box displays a preview of the scenario test progress actions as recorded. The dialog box automatically closes when the test is complete.  
    Screenshot showing the scenario test being executed
  4. In the Result column, verify that the result is Passed to signify the test case is successful.

Stop the Test Coverage session and view results

  1. Return to the Application: Test coverage tab.
  2. Click Stop coverage.
  3. Click Yes to stop the coverage and generate report.
  4. In the Coverage history section, click Show report for the Test coverage session you just ended.
  5. View the results of the Test coverage report. 
    Note: Because this challenge environment supports the completion of multiple challenges, the results of your Test Coverage Report may vary from what is shown above. It should be greater than 0% and show values for Executable rules, Covered rules, and Uncovered rules. 

This Challenge is to practice what you learned in the following Module:

Available in the following mission:

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

Did you find this content helpful?

33% 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