Configuring result count assertions

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.

  1. Open the Pega unit test case if it is not already open.
  2. Complete one of the following steps:
    • To add a new assertion, click Add expected result at the bottom of the page.
    • Modify an existing assertion in the pane.
  3. 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.
  4. 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.
  5. 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.
  6. Select the appropriate comparator from the Comparator list.
  7. In the Value field, enter the value that you want to compare with the object.
  8. Optional: To add a comment, click the Add comment icon, enter a comment, and click OK.
  9. Click Save.
Result: 

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.