How to unit test a flow

About Flows

Typically, you test a flow individually before testing it in the context of the entire application that you are developing. You run through the flow, providing sample data as the input, and examine the behavior and results to see if they are what you expect.Proj-94 C-2409 C-1493

If you have the AutomatedTesting privilege through an access role, you can use the options in the Test Cases tab in the flow form to run your flow with the option to record and save test cases.

The steps here for unit testing flows are applicable only to starting flows — that is, flows that have the Creates a new work object check box selected on their Process tabs. To unit test subprocesses and screen flows, you run the main flow that calls them.

For general information about testing a rule using the Run button Run, including a list of the clipboard pages that are generated when a rule runs, see How to test a rule with the Run Rule feature.

When you are testing a flow, the system creates a new test page and starts executing the flow, and you can create a work item. The type of window, the portal, and the skin rule (styles and appearance) of the user form depend on your operator preferences.

Starting the unit test

To start the run of the unit test:

  1. Save the rule.
  2. From the flow form, start the run of the flow:

    The system creates a new test page, and then starts a flow execution and you can create a work item.

  3. Step through each decision or assignment, providing representative input in each step.

    If you have the AutomatedTesting privilege, after the work item is created and you are running through the flow, the following options are available:

    Field

    Description

    Save Test Case

    Click to create a Test Case that holds the test data and the results for the flow execution recorded up to the point at which you click this button. The recording stops, the New Instance window for the new Test Case opens, and you can specify a name and description for the test case.

    For information about flow test cases, see the articles in the Testing Applications category of the PDN.

    Save Flow Marker

    Click to create a flow marker at a point in the flow. Flow markers identify points in the flow that you can jump to without having to input the same information again to reach that point. The recording stops and the New Instance window for the new flow marker opens; specify a name and description for the flow marker.

    For information about flow markers, see the articles in the Testing Applications category of the PDN.

    Save Resume Test Case

    Click to create a resume Test Case that holds the test data and the results for the flow process recorded between the previous assignment in the flow and the current assignment at which you click this button. The recording stops, the New Instance window for the new Test Case opens, and you can specify a name and description for the resume test case.

    Stop Recording

    Resume Recording

    Use these buttons to toggle between stopping and resuming the recording of the flow execution.

    After the work item is created, recording is in progress. If the recording is stopped, either from saving a test case at a point in the flow or from clicking the Stop Recording button, click the Resume Recording to begin recording again.

    Cancel

    Click to cancel the flow execution. The system returns to the start of the flow before creation of the work item.

  4. Run through the rule as many times as necessary, testing each possible path. Use the Where-Am-I? arrow Where-am-I?to see where an assignment is located in the flow diagram.

Related PDN articles

Up About Flows