Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Creating unit test cases for flows and case types

Updated on February 4, 2021

When you create a unit test case for a flow or case type, you run the flow 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 flow 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 ActionsRecord 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 ActionsRun.
  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. See Creating unit test cases for rules for more information.
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.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us