Close popover

Table of Contents

Configuring result count assertions

Version:

You can configure assertions to compare the number of items returned in a page list, page group, value list, or value group on the rule to the result that you expect to see on the clipboard.

For example, you can create an assertion that verifies that the number of returned results for the number of employees is greater than X number of employees, less than Y number of employees, or equal to Z number of employees.

Open the unit test case. For more information, see Opening a unit test case.
  1. On the bottom of the Definition tab, click Add expected result.

  2. For activities and data transforms, complete the following tasks:

    1. In the Page field, enter the page that contains the property for which you want to test the result count.

    2. In the Page class field, select the class to which the page belongs.

  3. In the of object field, enter the path of the object with which the results are compared or counted against during the assertion.

    • For data pages, this value is usually .pxResults.
    • For data transforms and activities, you can use any page list on a page.
  4. Optional:

    In the Filter field, enter a property and value on which to filter results or open the Expression Builder by clicking the Gear icon to provide an expression that is used to filter results. The list assertion applies only to the page list entries that are specified for this filter value.

  5. Select the appropriate comparator from the Comparator list.

  6. In the Value field, enter the value that you want to compare with the object.

  7. Optional:

    To add a comment, click the Add comment icon, enter a comment, and click OK.

  8. Click Save.

When you run the test case, the assertion fails if the expected value does not match the result count returned from the page list, page group, value list, or value group.

  • Defining expected test results with assertions

    Use unit test cases to compare the expected output of a rule to the actual results returned by running the rule. To define the expected output, you configure assertions (test conditions) on the test cases that the test, when run, compares to the results returned by the rule.

  • Converting unit tests to test cases
  • Creating unit test cases for rules

    For most rules, you can create a reusable test case by converting a unit test to a test case, configuring case details, and then defining expected test results with assertions (test conditions). When the test case runs, the test results are compared to the expected results defined for the rule’s assertions. If the test results do not meet the defined assertions, then the test fails.

Suggest Edit

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.