Skip to main content


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

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

Pega unit test cases for flows and case types

Updated on September 10, 2021

You can use Pega unit testing to create test cases for your applications. After you develop rules, you can test them, and then convert the test runs to Pega unit test cases to validate application data by comparing expected property values with the actual values returned by running the rule. You can create Pega unit test cases for a number of rule types, including case types and flows.

When you create a Pega unit test case for a flow or case type, you run the flow or case type and enter data for assignments and decisions as you step through the flow or case type.

You can start recording at any time, and you can stop recording at any time to create a test case with all the data that you entered up until the point that you stopped recording.

Creating a test caseCreating a test case

You can also create multiple test cases by clicking the tab that runs the flow or case type and continue to record the test case.

The system records the data that you enter in a data transform, which is created after you save the test form. It also displays the graphical representation of the recorded path.

Recorded pathRecorded path

For more information about creating Pega unit test cases for case types and flows, see Creating a Pega unit test case for a flow or case type.

You can configure four new assertions for flows and case types:

  • Assigned to
  • Attachment exists
  • Case status
  • Case instance count

Assigned to assertions to verify that an assignment is routed to an operator ID or work queue

You can use the assigned to assertion to verify that an assignment is routed to the appropriate operator ID or work queue. For example, if you record an entire flow, and the final assignment is routed to the Admin operator ID, you can verify that it is routed to the Admin operator ID. The expected output is compared with the data that is recorded on the pyWorkPage page.

Assigned to assertionAssigned to assertion

For more information, see Assigned to assertions.

Attachment exists assertions to verify that a file or note attachment exists

You can use the attachment exists assertion to verify that the flow or case type has an attachment of type file or note (attached by using the Attach Content shape) or email (attached by using the Send Email shape). If you have multiple attachments on flows or case types, the assertion checks all the attachments that are on the flow or case type. If it finds an attachment anywhere of the specified type and name, the assertion passes. The expected output is compared with the data that is recorded on the pyWorkPage page.

For example, you can verify that an attachment of type Email does not exist on the pyWorkPage page for a flow or case type.
Attachment exists assertionAttachment exists assertions

For more information, see Attachment exists assertions.

Case instance count assertions to verify the number of created cases

You can use the case instance count assertion to verify the number of cases that were created when the case type or flow was run.

For example, if you have a Job Applicant case type that spins off a Background check child case type, and you record the entire case type run, you can verify that the case instance count for each case type is 1.

Case instance count assertionCase instance count assertions

For more information, see Case instance count assertions.

Case status assertions to verify case status

You can use the case status assertion to verify the status of the case. The expected output is compared with the data that is recorded on the pyWorkPage page.

For example, if you record an entire flow, and the final assignment in the flow has a case status of Completed, you can verify that Completed is the case status.
Case status assertionCase status assertion

For more information, see Case status assertions.

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