Configuring unit test cases

Configure unit test cases to compare the expected output of a rule to the results that the test case returns.
Before you begin: Unit test a rule and convert the test run into a test case. For more information, see Unit testing individual rules.
  1. In the upper-right corner of the Definition tab, click the Gear icon.
  2. In the Edit Details dialog box, change the class, tested rule, or parameters that are sent to the test.
    Strategy rules have the following parameters.
    • componentName – The 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 rename either the componentName or pzRandomSeed parameter, the test case does not return the expected results.

    For example: 
    • 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 with no flow actions and flow actions on which postprocessing is not performed.
  3. Click Submit.
  4. In the Expected results section, provide the results expected of the test by configuring assertions. For more information, see Assertions.
  5. On the Setup & Cleanup tab, configure the actions to perform and the objects and clipboard pages to be make availabl before and after the test runs. You can also clean up the clipboard after the test is run by applying additional data transforms or activities. 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.
  6. Optional: Prevent the test from being run as a part of a test suite or from a REST service by selecting the Disable check box.
    The test case is executed only when it is run manually by clicking Actions > Run.
  7. In the banner, view more details about the latest test result by clicking View details.
    You can view details only after running a test case. For more information, see Viewing test results.
  8. In the banner, open a new dialog box that displays the test date, the run time, the expected run time, and the test result, click View previous runs, and then view detailed test results by clicking the row of a test case.
    This link is displayed after a test case has been run.
  9. Click Save. If you save the form for the first time, you can modify the identifier; however, after you save the rule form, you cannot modify this field.