Step/Data Simulation For Unit Tests
- 15 Sep 2021
- 1 Minute to read
- Print
- DarkLight
This documentation version is deprecated, please click here for the latest version.
Step/Data Simulation For Unit Tests
- Updated on 15 Sep 2021
- 1 Minute to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Overview
As of Decisions v.7.7+, users are provided the option to add unique mock data/Simulation paths to one or more Unit Tests. This allows the ability to run multiple different Unit Tests while testing different possible outcomes/Input Data.
To enable this feature:
Example
About Example
The following example involves utilizing a Flow that contains two previously configured Unit Tests. For information on how to configure Unit Tests in Decisions see:
- From a Flow that contains two configured Unit Tests, select the desired step for Simulation.
- From the step's Properties tab, navigate to TESTING SIMULATION > Use Simulation Behavior, and enable the InUnitTests option.
- Under Simulation Selected Path, select FromFlow, then click the EDIT [FLOW NAME] button.
- In the resulting Flow Designer, select the SETUP INPUT DATA button. In the Data Definitions window, define the desired mock data by providing a NAME and selecting the desired TYPE (this example uses Boolean) from the dropdown. Save and close the Input Data window.
- Design a Flow that Outputs an Outcome path to the End step (or End steps if multiple are involved). Save and close the Flow.
- Back in the Primary Flow, EDIT the Flow's Input Data and define Flow Input Data that matches the previously created Input from the Simulation Path Flow.
- Select the step that has the Simulation Behavior enabled; under TESTING AND SIMULATION > Simulation Data, map the newly defined Input Data to the Simulation Data.
- Save the Flow, then click the Debug link on the top Action bar.
- From the Debugger, If needed, EDIT the Unit Test Rule via the respective button under [UNIT TEST DATA] to match the Input Data.
- Uunder UNIT TESTS, select a Unit Test; Under DATA SOURCE FOR UNIT TEST RULE, select Input Data - Constant. Alternate Data SourceIf desired the From Flow option (see previous Alternate Example A: Flow As Data Source (v.7.7+) section on Unit Testing (Advanced) for detail) may be used as the Unit Test's Data Source.
- Under INPUT DATA, define the Input as desired, then click Save.
- Navigate to the other Unit Test and define the Input Data with a different value, then click Save.
- Click Run All to test each Unit Test and their unique mock data/Simulation paths. About Test ResultsUpon running the Unit Tests, if properly configured, the expected amount of Successful and Failed results should occur.
Was this article helpful?