Skip to main content

Testing your application

2 Tasks

40 mins

Visible to: All users
Beginner
Pega Platform '24.2
DevOps
English

Scenario

The Senior System Architect configured the vehicle information list to fetch car models from an external source. During the testing phase, one of the engineers reported that, intermittently, some car makes do not have associated model names. Additionally, stakeholders are concerned about application performance and require that the vehicle information list is generated within 200 milliseconds.

To meet these requirements, the Deployment Manager has asked you to:

  • Create unit tests to test the vehicle information list and confirm the model list generates in the time threshold.
  • Run a Test Coverage session using the unit tests 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 information Data Page and create a unit test

  1. In the Pega instance for the challenge, enter the following credentials:
    1. In the User name field, enter tester@gogoroad.
    2. In the Password field, enter pega123!.
  2. In the navigation pane of Dev Studio, click Data types to open the Data Explorer.
  3. Expand Vehicle information, and then click List Vehicle information to edit the D_VehicleinformationList Data Page.
    Vehicle information list data page
  4. In the upper right, click Actions > Run. The Run Data Page window is displayed.
  5. For the make parameter, in the Value field, enter Tesla as the test value.
  6. For the modelyear parameter, in the Value field, enter 2017 as the test value.
  7. In the upper right, click Run to test the Data Page.
  8. Expand the pxResults property and confirm that the property includes three results pages.
    The vehicleinformationlist data page run screen with Tesla and 2017 as parameters.
  9. In the upper right, 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.
    Convert to test
    Note: The parameter values entered in the Run Data Page window are automatically populated in the Edit Test Case window.
    Unit Test Case Parameters
  10. In the Edit Test Case window, in the Expected results section, verify that the Assertion type list value is Expected run time.
  11. 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
  12. In the second Assertion type list, select Result count
  13. In the of object field, enter or select .pxResults.
  14. In the Comparator list, select is greater than.
  15. 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
  16. Click Save.
  17. In the Label field, enter VehicleInformationList_Tesla to name the test case record.
  18. In the Add to Ruleset and version lists, verify that the highest Ruleset version is selected.
    TC_VehicleInformationList_Tesla save configuration
  19. Click Submit to create the unit test.

2 Create unit tests for different vehicle makes

  1. In the VehicleInformationList_Tesla test case, to the right of Save, click the down arrow.
    Saveas button on the unit test case
  2. Click Save as.
  3. In the Label field, enter VehicleInformationList_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.
    Unit test case edit parameters gear icon
  6. In the Parameter(s) sent section, in the make field, enter Ford.
    Unit test case edit details
  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>.
    VehicleInformationList unit testcase
     
  10. Click Save to complete the configuration of the unit test. 
  11. Repeat steps 1-10 to use VehicleInformationList_Saturn as the test case label and Saturn as the make parameter.
    Vehicle Information Saturn Pega unit test case

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.
    built-on
  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 PegaAcademyTestRun 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.
    Unit testing landing page with run selected testcases
  4. In the Result column verify that the Tesla and Ford unit test cases passed and the Saturn unit test case failed.
    Unit testing test results
  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.
    Test run logs
  6. Click the test result to show the test results for VehicleModelsList_Saturn, which confirms that not all vehicle makes have at least one associated model.
    Test result for VehicleInformationList Saturn

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.
    Test coverage report
  5. View the results of the Test coverage report.
    Test coverage session1 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?

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