Unit testing a decision table

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 Pega unit test case.
  1. Open a decision table by clicking Records > Decision > Decision Table and selecting the decision table that you want to unit test.
  2. Click Actions > Run.
  3. From the Data Context list, select the thread on which you want to run the rule.
  4. Specify the page that you want to use as the main test page by selecting one of the following options:
    • Copy existing page — Copies values from an existing clipboard page in the selected thread to the main test page.
    • Create or reset test page — Creates a test page or resets the values on an existing page. Selecting this option lets you:
      • Apply a data transform to the values on the test page by clicking the link in the Apply field and selecting a data transform.
      • Clear previous test values entered in the Result pane by clicking Reset Page
      • Switch the current context by selecting a thread from the Data Context list and clicking Switch Context.
  5. Display the test results by entering input data in the Result pane and clicking Run again.
    Result: 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.
  6. Optional: Open the Clipboard by clicking Show Clipboard and examine the pages generated by the unit test.
  7. Optional: Convert this test into a Pega unit test case, which you can use to validate application data in a continuous delivery environment by performing the following actions:
    1. Click Convert to Test.
      Result: A new tab appears in the main Designer Studio window.
    2. Configure the Pega unit test case.
      For more information, see Modifying Pega unit test cases.
  8. Optional: Go directly to the row on the Table tab that produced the test result by clicking the Result Decision Paths link to.
    If the Evaluate All Rows option on the Results tab is selected, all the rows that are true are highlighted.