Sunday, January 1, 2017

Designer Studio – How to unit test a rule with the Run Rule feature

The Run toolbar action opens the Run Rule window for the currently displayed rule. You provide test data and then Pega 7 Platform runs the rule and displays the results. If the results are not what you expected, modify the rule and test it again.
The appearance of the Run Rule window varies across rule types, so how you run a rule varies by its type. In general, you complete the following kinds of tasks:
  • Specify whether to create a test page, or, if any pages of the appropriate class already exist on the clipboard, to copy one.
  • Select a data transform to use when Pega 7 Platform creates a test page.
  • For services, specify whether the service rule is to run in your session or as a newly created service requestor. If the service is configured to run as an authenticated user, you are prompted for a username and password.
  • Provide test data to use when the rule runs.
The Run Rule feature uses rule resolution when running the rule. If you click the Run button but a higher version exists of the rule that you currently have open, Pega 7 Platform displays a status message stating it will run the higher version. Accordingly, to test a circumstanced or time-qualified rule, ensure that the circumstances are correct for the rule. Otherwise, the base (unqualified) ruleruns instead of the one you intend to test.
Clipboard pages
After running a rule, you can open the Clipboard tool and examine the output as it appears on the resulting clipboard pages. The Run Rule operation creates the following pages:
  • RuleToRun — The clipboard representation of the rule that you tested.
  • runRulePage — Holds the output from the rule.
  • temp_ pages — Pages created or copied by the Run Rule feature when it ran the rule. The names of these pages begin with the literal temp_.
  • pySimulationDataPage — For service rules, a page of the helper class Data-Admin-IS-ClientSimulation. Contains information about the simulated request and response.


No comments:

Post a Comment