Skip to main content


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

Unit testing individual rules

Updated on November 15, 2021

An incorrect rule configuration in an application can cause delays in case processing. To avoid configuration errors such as incorrectly routed assignments, unit test individual rules as you develop them. To expedite future rules testing, you can create reusable test cases from the unit test.

You can test a rule with test data that you provide by clicking Actions > Run on the rule form toolbar. For some rule types, such as binary file rules, Pega does not provide an option for unit testing. If the rule cannot be unit tested, the Run option is not available.

The appearance of the Run Rule window varies across rule types, so how you run a rule varies by its type. In general, however, the rules run by using data from a test page that you define for the test.

Tasks involved in defining the test page include the following.

  1. Selecting a method for creating the test page – You can copy values from a thread of an existing clipboard page to the test page, create a new test page, or reset the values of an existing test page. For more information about clipboard pages, see Clipboard tool.
  2. Applying data transforms – For a reusable and expedited method of making decisions and calculating values, you can apply data transforms to set values for the test page. For example, to unit test a decision table, you can create a data transform to provide values for the properties evaluated by the table, rather than manually entering values when you run the rule. For more information about data transforms, see Data transforms.
  3. Manually entering test data – In some cases, you can manually enter values to use. If you enter values for a test, the values that you enter override values on the test page.
  4. Specifying how service rules run – For services, you also specify whether the service rule is to run in your session or is to run as a newly created service requestor. If the service is configured to run as an authenticated user, you are prompted for a user name and password.
Note: To test a circumstance rule, ensure that the circumstances are correct for the rule. Otherwise, the system tests the base rule.

When you run the rule, the system uses rule resolution. If you unit test a rule, and there is a higher version of the rule, the system runs the higher version.

After you run the test, you can also convert the test to a reusable test case that you can run at any time. For more information about using unit test cases, see Understanding unit test cases.

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