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.

How to test flows with Automated Unit Testing (PRPC 6.1)

Updated on September 10, 2021

Summary

You can use Automated Unit Testing to record and play back test cases for flow rules in 6.1. By creating and saving test cases for your flow rules, you can automate regression testing on the flows when subsequent development work occurs.

For information about working with flow test cases in releases before 6.1, see How to create flow rule test cases using the Run Rule window (V5) and How to execute flow rule test cases using the Run Rule window (V5).

Suggested Approach

A typical business situation has an application with a number of work object types and the flows that process those work objects. At a point in time, the flows are working exactly the way that you want, and at this "happy state" point, you record test cases of the flows and save the test cases. Later, after subsequent development, intended changes made to one flow might have unintended impacts on the other work object types and flows. At that point, the flow can be played back against the saved test cases — either manually or automatically as part of a scheduled unit test suite — to quickly discover and address any unanticipated effects.

Note: You must have the AutomatedTesting privilege to be able to record and play back test cases. See How to enable Automated Unit Testing (PRPC 6).

Quick links

Creating and saving test cases for flow rules

You begin recording a test case from a starting flow; the flow's subflows and screen flows are recorded as they are called from the main flow.

To record a test case for a flow rule:
  1. Open the flow rule and go to the Test Casestab.

    If this flow has any saved test cases, they appear on this tab.

  1. Click Record New Test Case.

    When you click this button, the system creates a new test page and starts executing the flow, beginning with creating a work object. The type of window, the portal, and the skin rule (styles and appearance) of the work object form depend on the Run Process In settings of your operator preferences.

    In this example, the work object is a purchase order.

  1. Click Createto create the work object and start running through the flow process.

    After the work object is created, the Save Test Case button is available to save the test case.

  2. Enter the test data as required to advance the work object through your flow process.

    You can stop recording and save a test case at any point after the work object is created. Therefore, you can save separate test cases for different portions of a flow and subsequently do regression testing on the individual portions. For example, you might record and save one test case for the portion of the flow where the work object is assigned to the current operator for collecting input, and then record and save another test case (a "resume test case") for the portion of the flow where the work object is assigned to a manager for review and approval.

  3. Save the test case by clicking Save Test Case. The Test Case: New window opens. Specify a name, description, and the RuleSet information for the RuleSet you are using for your test case rules, and click Create. The system saves the new test case rule.

To see the just-created test case rule, return to the Test Cases tab of the flow rule form and click Refresh.

Regression testing flow rules using test cases

After subsequent development on the flow rule or related rules occurs, that development might alter the behavior of the flow in unanticipated ways. By playing back your saved test cases and assessing the extent of any changes, you can quickly discover and address any unwanted effects.

When you suspect flow behavior might have changed — using the Invalid Test Cases report

When you suspect the flow's behavior might have changed, you can view the Invalid Test Cases report and see the list of the flow's test cases that might need to be updated, or deleted and re-recorded. When you click Invalid Test Cases on the Test Cases tab, the system collects the set of test cases that were saved before the last time the flow rule was changed. Then, if any of those test cases have results that are different than when they were originally recorded, the system reports a list of those test cases. In this way, you are alerted to which test cases to investigate.

Playing back flow test cases

To play back a flow test case:
  1. Open the flow rule, go to the Test Casestab and click the name of the test case.

    Before the process playback begins, first choose whether to have the playback run until the system finds a difference or to walk through each step of the flow:

ModeUse to
Run until differences foundQuickly verify whether any differences have been introduced into the flow process since the test case was recorded
Walk through each step of the flowExamine each step of the flow and have the opportunity to input new values into the test case prior to each step

  1. Click Play.

The process's work object form appears in the lower half of the window as you progress through the test case. Red highlighting in the work object form reflects differences between the current state and the recorded test case.

WhenWhat happens during playback
Running until differences are foundThe system displays that step in the flow where the system detects differences between the current flow's database values and Clipboard pages and those values and pages in the stored test case. Click Next Difference to continue. When no differences are found, the flow advances to the end of the recorded test case.
Walking through each step of the flowThe system displays each flow step in sequence. Click Next Flow Step to continue.

Playback: Running the test case until differences are found

If the flow has changed prior to playing back this test case, the system likely finds differences when it compares the current results with the recorded test case. Here is an example where the change in the flow was to change the Confirmation Note on the ManagerApproval assignment from AwaitingVerification to AwaitingApproval.

You can choose to ignore a difference by selecting a radio button in the Ignore for column. For example, if you have a Date type of property that the process sets to the current date plus 5 days, playing back the test case on different days will give different resulting values for that property. Instead of having this flagged as a difference every time, you can choose to ignore that property just for the current test case, or for all saved test cases for this flow rule. Once you have determined which differences to ignore at that particular step in the flow, click Save Ignores to save your selections to the test case.

If you determine that the current state of this flow step is what you want, you can permanently overwrite this step in the test case with the current state by clicking Overwrite Step. The system saves the current database values and Clipboard pages to the test case; the display refreshes so you can continue to the next difference.

Playback: Walking through each step of the flow

As you walk through the recorded test case, the system displays for each flow step:

  1. First, the input values that were recorded entering the flow step.
  2. Then, after you click Next Flow Step, the result of the process after the step is taken.
Example: Input values prior to Step 1

Example: Results after Step 1

If a difference is found in a step's result, you can choose to ignore the difference, and update the test case to save the ignored difference. You can also permanently overwrite the step in the test case with the current state by clicking Overwrite Step.

Playback: Changing input values for a test case's flow step

As you walk through each step of the flow, you can change the input values that were recorded in the test case for that step by:

  • Directly editing the values in the Input Values Prior to Step section
  • Using the Dynamic Input Builder ()

 

At each step, to save any changed input values for that step in the recorded test case, click Save New Inputs.

Specifying input values for a test case using the Dynamic Input Builder

To specify a dynamically created input value, click to use the Dynamic Input Builder to guide you in creating that value.

For example, if you want the test case to validate that a SubmitOrderDate field uses the current date, select Today in the Function field of the Dynamic Input Builder. To use an activity to set the value, select Activity in the Function field, and then select the activity and specify the appropriate values for its parameters.

Saving results at flow steps

If unexpected results are found at a flow step during test case playback, you can use the Save Results button to save the step's results for future viewing.

For example, if there are multiple issues and you want to concentrate on investigating one issue at a time, you can save the results, close the test case playback, and investigate the first issue. Then, when you've completed that item, you can view the saved results and locate the next issue without having to play back the test case again. In a team environment, a developer or tester can save the unexpected results for another team member to see without the other person having to play back the test case.

On the flow rule's Test Cases tab, click View Results to see a test case's saved results:

When you click View Results, a report window shows a summary of previously saved results.

Click a row to see the details of the differences in that saved result.

Viewing a summary of results at the end of test case playback

At the end of test case playback, you can view a summary that shows the results at each flow step by clicking View Flow Summary.

This summary displays all database and clipboard differences that are found for each step during the playback. By expanding each item in the summary, you can see the found differences, the values expected in the recorded test case, and the values from this playback.

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