Skip to main content
This content is now archived and is no longer updated. Progress is not calculated. Pega Cloud instances are disabled, and badges are no longer awarded. Click here to continue your progress in the latest version.

Unit testing individual Rules

Pega Community logo

Note: The following content, referenced from Pega Community, is included here to help you better achieve the module learning objectives.

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. 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 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 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.


This Topic is available in the following Module:

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

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice