When you create a unit test Case for a process or Case Type, you run the process or Case Type and enter data for assignments and Decisions. The system records the data that you enter in a Data Transform, which is created after you save the test form. You can start recording at any time.

Certain Conditions apply on the data that you can record for processes and Case Types. For information, see Data that you can record for flows and Case types about the data that you can record.
Restriction: From Pega Platform™ version 8.5, running and recording a test Case for a process that has a Create Stage is no longer possible for new Case Types. If you have migrated from a version lower than 8.5, you can include the process in any Stage of a migrated Case Type, and then run the test on the process.

Before you begin:

Exclude properties in your work class from the test by modifying the pxCapturePropertyIgnore Data Transform. For more information, see Data that you can record for flows and Case typesabout the data that you can record.

  1. Open the flow or case type for which you want to record a test.
  2. On the toolbar, click Actions > Record test Case.
    The system starts running the flow or Case Type.
  3. Enter input as you step through the flow or Case Type.
  4. Click Create test Case in the lower-right of the screen to save the recording as a test Case.
  5. Click Save, enter a label that identifies the test case, and then click Submit.
  6. Optional: To modify the rule or class that is used for the test, in the upper-right corner of the Definition tab, click the Gear icon, select the rule or class, and then click Submit.
  7. Optional: To prevent the test from being run as a part of a test suite or from a REST service, on the Definition tab, select the Disable check box.
    The test Case will be run only when you manually click Actions > Run.
  8. In the Expected results section, add assertions that define the expected results of the test. For more information about creating assertions, see Defining expected test results with assertions.
  9. On the Setup & Cleanup tab, configure the Actions to perform and the objects and Clipboard Pages to be available before and after the test runs. You can also clean up the Clipboard after the test is run by applying additional Data Transforms or activities. For more information, see Setting up and cleaning the context for a test Case or test suite.
  10. Click Save.
  11. Configure the unit test Case.

Result:

After you save the test Case, a Data Transform, which captures the input that you entered, is created and associated with the test Case. You can edit this Data Transform to modify the test Case input. The Edit test Case form also displays the path of the flow or Case type.