Creating and Running a Test Case
Unit testing tests smaller chunks of work in a process.
A test case is a basic building block of unit testing. A test case can have one or more assertions on the activities in the main flow, activities in the error handler, or on the flow output. One flow can have multiple test cases.
To enable the unit testing mode, click the .flogotest
file in the Explorer view. To exit the unit testing mode, click the .flogo
file in the Explorer view.
Configuring Unit Test Data
To design a unit test case, you need to configure the flow inputs, activities, and flow outputs with the appropriate data. When you click any of these components, a configuration dialog opens where you can configure the data. You can configure activities using any of the modes listed in Unit Testing Modes.
Unit Testing Modes
The following tables provide a detailed explanation of the various testing modes available for configuring the unit test cases.
Option | Description |
---|---|
Execute (Default) | This is the default mode for all activities. When an activity is set to this mode, it runs as per the definition and configuration and does not affect the unit test execution. You can use this option to reset your unit test configurations on the activity. |
Assert on Outputs | Adds an assertion for flow output. |
Assert on Error | Asserts if an activity generates an expected exception. It is applicable for a given input of the flow. Users should add proper error handlers through an error branch or by defining the error handler flow. |
Mock Outputs |
Use mock data for the activities that have an output. For more information, see Using Mock Data. |
Mock Error | Simulates an exception with an optional message instead of executing the activity during a test run. It helps test the error handler design of the flow. |
Skip Execution |
Skip an activity in unit testing if the activity does not have any output. For example, you can skip activities, such as Sleep, eFTL Publish message, or StartaSubFlow.
Note: To skip an activity with an output, you can mock it without any configuration data. For activities that do not have an output, you can select Skip Execution.
For more information, see Skipping an Activity with No Output. |