Unit Tests Overview (Simple Flow)

Last Updated: 07/19/2016 Introduced in Verision: 3.5

In Decisions 3.5 Unit Test utility is separated from the Debugger. User is able to Test Flow/Rule and see if it is executing correctly in the Debugger or create Unit Tests to apply custom Rules to the places in the Flow/Rule that need to be tested.


This document overviews main features of Unit Test utility on the simple Flow example.

We start in the Designer Folder by clicking Create Flow on the Folder Actions Panel.


In the resulting window we Name the Flow and click Create to proceed to the Flow Designer.


In the Flow Designer we select Start step on the workspace and add simple String Input into our Flow.


Then, we connect Start step to the End step in the Flow. With End Step selected we add simple String Output to our Flow.


For the Output that we just created we use Select Value Mapping type and select Input Value that we created in the Start Step.


As a result, we have a simple Flow with simple String Input, one Outcome Path, and simple String Output. Mention, on the Top Panel of the Flow Designer there is no Debug Flow option. Instead of Debug Flow we have Test Flow and Unit Test. We click Test Flow


Mention, that Flow Designer do not ask us to create a Unit Test because our Flow has a variable input unlike Decisions 3.2 and older versions. Debugger opens and asks us to provide a Value for the Flow Input. Then, we click Run.


The Flow executes in the Debugger just like in previous versions of Decisions.


Back in the Flow Designer we click Unit Test on the Top Panel of the Flow Designer.


Because there are no Unit Tests created for this Flow, Wizard asks us to create one. In this example we are going to create Unit Tests to test Flow Input, Flow Output, and Flow Outcome Path. We Name first Unit Test and define Flow Input. For each Unit Test we need to write a Test Result Evaluation Rule. This Rule will have a logic to test if our Flow executes as we designed at particular points of execution. We click Edit Test Result Evaluation Rule.


Rule Designer opens. Note: if our Rule returns true, Unit Test passes. We click Add New Rule Step.


Mention, for this simple Flow Unit Test Rule we have some additional input data:

  • Input (to test Flow Input)
  • Outcome_PathName (to test if our Flow was executed on particular outcome)
  • Outcome_Done_Output (to test Flow Output value on Outcome Path Done)

We select Input for this Unit Test.



We expect this Unit Test to pass so we write a Rule where Input equals the value that we provided as Flow Input for this Unit Test. When finished we can save the Rule and close Rule Designer.


Back in the Flow Unit Tests wizard we click Save.


Then, in Flow Unit Tests window we can see our first Unit Test saved. We can click Create New to add more Unit Tests for this Flow. Again, we provide Test Name, Input, and click Edit Test Result Evaluation Rule.


We build second Rule to test Flow Input and return False.


Next, we add another Unit Test to check if Outcome_PathName is done. This Unit Test checks if our Flow was executed on the Outcome Path that we expected.


Then, we add another Unit Test with the Rule that checks Outcome_PathName and returns False.


Finally, we create two Unit Tests for the Flow Outcome. First Test should pass. In the Rule for the Unit Test we check if the Outcome_Done_Output equals Input.


Lastly, we add a Unit Test to check Outcome_Done_Output and return False.


As a result, we have six Unit Tests for our simple Flow… In the Flow Unit Tests window we can click Run All to run all Unit Tests.


… and they execute as we expected.




Additional Resources