Testing Flows from the CLI

Note: The information in this section is applicable for an app executable only.

This feature allows you to test your Flogo app using the Flogo app executable itself. Once you have built the executable for a Flogo app, you can test it using the test command. This feature is also useful to automate the testing process for a flow.

Note: The flow tester only supports outbound connections on port 1024-9999. So, any flow making connection on the port outside of this range times out.

You can do the following from the CLI:

  • List all flows in a specified app
  • Generate test data for a given flow
  • Test a flow against test data you specify in a JSON file
  • Test a flow against test data you specify in a JSON file and generate the output of the test in an output file that you specify

Before you begin
  • The app executable must be readily accessible on the machine from which you plan to test it.

Follow these steps to get help on the test command:

    Procedure
  1. Open a command prompt or terminal window depending on your platform.
  2. Navigate to the folder where you stored the app executable.
  3. Run the following command to get the online help on the test command:

    On Windows: <app-executable> -test

    On Macintosh: ./<app-executable> -test

    On Linux: ./<app-executable> -test

    This command outputs the usage for the test command along with some examples. Refer to test Command for details.

  4. Run the command with the appropriate option to test your app. For example, if your app executable name is MyTestApp-darwin-amd64, to get the names of the flows in your app, run: ./MyTestApp-darwin-amd64 -test -flows
    The output of the command lists all the flows in the app.

Using the test command to test your flow from the CLI

To test a flow:

    Procedure
  1. Generate the input JSON file using the -flowdata option with the command as described  (./<app_executable> -test -flowdata <flow_name>). This generates a JSON file (<app-name>_<flow-name>_input.json) with the input fields that you specified when creating the flow on the Input tab of the Flow Inputs & Outputs tab of the blank flow.
    Note: You can also use the test configurations that were exported from Launch Configuration as the input file instead of generating the input file with the -flowdata option.
  2. Modify the generated file, <app-name>_<flow-name>_input.json, from step 1 to set specific values for the input fields in the file.
  3. Use the <app-name>_<flow-name>_input.json file to test your flow:
    ./<app_executable> -test -flowin <app-name>_<flow-name>_input.json -flowout <output>.json

    For example, if your app name is MyTestApp and the input file generated by -flowin is MyTestApp_MyFlow_input.json and the output file you specify for -flowout is MyOutput.json, the command looks as follows:

    ./MyTestApp -test -flowin MyTestApp_MyFlow_input.json -flowout MyOutput.json