You are here: Reference > Rule types > Decision Trees > Unit testing a decision tree

Unit testing a decision tree

You can use the Run Rule feature to test a decision tree individually before testing it in the context of the application that you are developing. You specify a test page for the rule to use, provide sample data as the input, run the rule, and examine the results.

Optionally, you can convert the test run to a PegaUnit test case.

To unit test a rule, complete the following steps:

  1. Open a decision tree by clicking Records > Decision > Decision Tree and clicking the decision tree that you want to unit test.

  1. Select Actions > Run.

  2. From the Data Context list, select the thread on which you want to run the rule.

  3. Specify the page that you want to use as the main test page.

  4. Enter input data in the Result pane and click Run again to display the result returned by the test. The input value that you enter and the result that is returned are the values that are used for the default decision result assertion that is generated when you convert this test to a test case.

  1. Optional: Click Show Clipboard to open the Clipboard and examine the pages that are generated by the unit test For information, see Clipboard pages created by the Run Rule feature.

  2. Optional: To convert this test into a test case, click Convert to Test. A new Create Test Case tab is displayed in the main Designer Studio window.

  3. Optional: Click the Result Decision Paths link to go directly to the row on the Decision tab that produced the test result.