Configuring Pega unit test cases

Configure a Pega unit test case with at least one assertion (test condition) to compare the expected output of the test with the actual results returned by running the test. For example, you can verify the number of cases that were created for flows and case types. You can also configure optional information, such as modifying input parameters that were sent to the test.

  1. Complete one of the following actions:
    • If you are modifying a test case, open the test case if it is not already open.
    • If you are creating a new Pega unit test case, configure at least one assertion. For more information, see Assertions.
  2. Optional: Complete any of the following actions:
    • Modify the parameters, if any, that are sent to the test by clicking the Gear icon next to the parameters that were sent. There are two parameters for strategy rules:
      • componentName: Name of the component (for example, Switch) that you are testing.
      • pzRandomSeed: Internal parameter, which is the random seed for the Split and Champion Challenger shapes. It is generated for all components, but only applies to the Split and Champion Challenger components.
      ‚ÄčIf you rename either the componentName or pzRandomSeed parameter, the test case does not return the results that you expect to see. For example:
      • If you configure the test to run on a different component, if a property is not found the test might fail.
      • If you change the pzRandomSeed value on the Split or Champion Challenger shapes, the test fails.
    • For flow rules and case types, view the path of the flow or case type. The path does not display:
      • Child cases that do not have flow actions configured on them.
      • Flow actions on which post-processing is not performed.
    • Modify the description of the test case.
    • Apply one or more data pages, data transforms, or activities to set up the clipboard before running a test in the Setup & Cleanup tab. You can also use activities to create any required test data, such as work or data objects. For more information, see Setting up your test environment.
      Note: The Setup & Cleanup tab is displayed for strategy rules only when you create test cases for them in Dev Studio.
    • Apply additional data transforms or activities to clean up the clipboard in the Setup & Cleanup tab. For more information, see Cleaning up your test environment.
    • Configure assertions to compare expected and actual values. For more information, see Assertions for more information.
    • Prevent the test from being run as a part of a test suite or from a REST service by selecting the Disable check box.
    • Run a test case by clicking Actions > Run.
      Note: This is the only way to run a disabled test case.
    • To view more details about the latest test result, click View details in the banner. This button is displayed after a test case has been run. For more information, see Pega unit test case run results.
    • To open a new dialog box that displays the test date, the run time, expected run time, and whether the test passed or failed, click View previous runs in the banner. To view detailed test results, click the row of a test case. This link is displayed after a test case has been run.
  3. Click Save. If you are saving the form for the first time, you can modify the identifier; however, after you save the rule form, you cannot modify this field.