Running Unit Tests on a Flow

1 In a Designer Project, click CREATE FLOW on the Global Action Bar. Select Flow, name the Flow (AdditionFlow) and click CREATE. 

2 Click SETUP INPUT DATA. Click DEFINE.

3 In the Input Data window, enter "Number" under NAME and change the TYPE to Int32 [Number]. Click Save and close the window.

4 Click the Done path on the Start step. Navigate to All Steps [Catalog] > Data > Numbers and select the Add step. Click ADD.

5 On the Properties panel, click Edit Input Mappings.

6 Attach the Number path to Value1. For Value2, select Constant map and enter "10". Click OK.

7 Attach the Done path of the Add step to the End step.

8 Select the End step. On the Properties panel click SHOW EDITOR from under the Output field under the DATA category.

9 In the window, enter "NumberOut" with an Int32 [Number] Type. Click the pencil icon. Select Unknown and select Select From Flow. Select Add_Output and click DONE. Click Save and close the window.

10 Click Save to save changes to the Flow. 

Add Unit Test

1 On the top action barclick Debug.

2 Next to UNIT TEST, click Add New.

3 Enter "Failed Test" in the Test Name field. Under the INPUT DATA - CONSTANT category, enter "5" as the Number. Click EDIT UNIT TEST RULE.

4 Click Select Data Element and select Outcome_Done_NumberOut. Click NEXT.

5 Select Equals as the verb and click NEXT.

6 Enter "25" in the value field and click DONE. Click Save to save changes and close the Rule Designer.

7 Click Save to save the Unit Test.

8 Add another Unit Test named "Successful Test" with a constant number of "5". Configure the Unit Test Rule to evaluate if "Outcome_Done_NumberOut Equals 15".

9 Click Run All next to UNIT TEST. 

10 The first test will have a Failure result. The second test will have a Successful result. To run a test individually, click the play button on the right side of each unit test entry.

from: https://documentation.decisions.com/v9/docs/running-unit-tests-from-the-flow-designer

Sign In or Register to comment.