You are here: Reference > Rule types > Activities > Unit testing an activity

Unit testing an activity

You can use the Run Rule feature to test an activity individually before testing it in the context of the application that you are developing. Optionally, you can convert the run to a PegaUnit test case.

You can use the Run Rule feature if one of the following criteria is met:

To unit test an activity, complete the following steps:

  1. Open an activity by clicking Records > Technical > Activity and selecting the activity that you want to open.
  1. Select Actions > Run.

  2. Select the thread in which you want to run the rule from the Thread list in the Run context pane.

  3. Specify if you want to set up initial values on the clipboard.

    Note: The system always runs the rule instance on the RunRecordPrimaryPage, regardless of the page that you select from this list. If you convert this rule run to a test case, and the RunRecordPrimaryPage requires initial values, you should set the clipboard up to populate the page with initial values. See Setting up your test environment.

  1. Optional: In the main test page, enter values for parameters, if any, to pass to the rule.

  2. Click Run.

  3. A dialog box appears that displays the results of the rule run. Close the dialog box to continue.

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

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

  6. Optional:Click Trace to debug the rule with the Tracer tool.