Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Configuring list assertions

Updated on February 4, 2021

You can create list assertions for page lists on a rule to determine if either the expected result is anywhere in the list of results returned by the rule. Even if the order of results changes, the test will continue to work.

For example, you can verify if a product is present in a product list in a data page, regardless of where the product appears in the list results. You can also verify if there is at least one employee with the name John in the results of the Employee list data page.

You can also configure assertions for page lists to apply assertions to all the results that are returned by a rule so that you do not have to manually create assertions for each result in the list.

For example, you can verify that a department name is Sales and that a department ID starts with SL for each department in the list of results in the Sales department data page. You can also verify if a discount of 10% is applied to each customer in the list of results of the VIP customers data page.

You can configure list assertions for page lists on a rule to apply assertions to all the results that are returned by the rule. Configure an ordered list assertion so that you do not have to manually create assertions for each result in the list.

Before you begin: 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. From the Assertion type list, select List.
  3. Add properties to the assertion.
    1. Click Add properties.
    2. If you are adding properties for flows, case types, decision trees, decision tables, or data pages:
      1. In the of object field, enter the path of the object with which the properties are compared during the assertion.
      2. Proceed to step d.
    3. If you are adding properties for data transforms or activities, complete the following tasks:
      1. From the Thread list in the Actual results section, select the thread that contains the page whose properties or pages you want to add.
      2. In the Page field, enter the page whose properties or pages you want to add.
      3. In the of object field, enter the path of the object with which the properties are compared during the assertion.
      4. Proceed to step d.
    4. Select the properties or pages that you want to add. You can search for a property or its value by entering text in the search bar and pressing Enter.

      If you select a page, all embedded pages and properties from the page are added. Added properties are displayed in the right pane.

      When you add multiple properties, the assertion passes if the expected output and results match for all properties.

  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. From the Comparator list, select the comparator that you want to use to compare the property with a specified value.

    Select the is in comparator to compare a text, integer, or decimal property to multiple values. The assertion passes if the property matches any of the values that you specify.

  6. In the Value field, either enter a value with which to compare the property or open the Expression Builder by clicking the Gear icon to enter an expression that is used to provide the value.
    Note: The Gear icon is not displayed until after you have saved the rule form.
  7. To add a comment, click the Add comment icon, enter a comment, and click OK.
  8. Click Done.
  9. Click Save.
Result:

When you run the test case, the system searches for the specified properties in the page list. One of the following occurs:

  • If you selected In ANY Instance, the assertion passes if all the properties in the set match the expected values in the page list. If none of the properties match any of the values in the page list, the assertion does not pass.

  • If you selected In ALL instances, the assertion passes if all the properties in the set match the expected values in every entry in the page list. If any of the properties do not match any entry in the page list, the assertion does not pass.

Have a question? Get answers now.

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

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us