You can use the Run Rule feature to test a decision table 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:
Open a decision table by clicking Records > Decision > Decision Table and clicking the decision table that you want to unit test.
Click Actions > Run.
From the Data Context list, select the thread on which you want to run the rule.
Specify the page that you want to use as the main test page.
Copy existing page – Select to copy values on an existing clipboard page in the selected thread to the main test page. Then, from the list, select the page whose values you want to copy.
Create or reset test page – Select to create a test page or reset the values on an existing page. Next, you can do one of the following actions:
Apply a data transform to the values on the test page by clicking the link in the Apply field and selecting a data transform.
Click Reset Page to clear previous test values that are entered in the Result pane.
Switch the context in which you are working by selecting a thread from the Data Context list and clicking Switch Context.
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.
Optional: Click Show Clipboard to open the Clipboard and examine the pages that are generated by the unit test. For more information, see Clipboard pages created by the Run Rule feature.
Optional: To convert this test into a PegaUnit test case, which you can use to validate application data in a continuous delivery environment,, do the following tasks:
Click Convert to Test. A new tab is displayed in the main Designer Studio window.
Configure the PegaUnit test case. For more information, see Configuring PegaUnit test cases.
Optional: Click the Result Decision Paths link to go directly to the row on the Table tab that produced the test result. If the Evaluate All Rows option on the Results tab is selected, all the rows that are true are highlighted.