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.
-
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.
- 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. Strategy
rules: have the following parameters
- 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 applies only to the Split and Champion Challenger components.
- If you configure the test to run on a different component, the test might fail if a property is not found.
- 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 postprocessing 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 and after running a test in the Setup section of
the Setup & Cleanup tab. You can also create objects, load
work and data objects, and add user pages from the clipboard that will be available on
the clipboard when running the test. 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 after the test is run in the Cleanup section of the Setup & Cleanup tab. You can also prevent the test data from being removed after the test is run. For more information, see Cleaning up your test environment.
- Configure assertions to compare expected and actual values. For more information, see Assertions.
- 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 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. Viewing details is possible 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.
- Modify the parameters, if any, that are sent to the test by clicking the
Gear icon next to the parameters that were sent. Strategy
rules: have the following parameters
- 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.