🚧

This feature is not yet live

To test workflows that include data connectors, it's often useful to mock the responses from those data connectors, so you can test specific cases.

Through the Sliderule UI, you can set mock responses via the Advanced Settings page of the UI. But we now offer the ability to set up mock responses when calling your workflows via API.

Calling the test endpoint with mock data

Say you have a simple workflow with a data connector that calls the Star Wars API - and rejects planets that are deserts.

To test your workflow, you can mock the response from that data connector, and see what happens in your rules, using the testExecute endpoint.

We would call: https://api-dev.sliderule.io/v1/workflow/105/testExecute?dryRun=true

With the following payload:

{
     "payload":{
        "id": 1
     },
     "ruleSetMocks":{
        "Get Planet Info": {
            "output": {
                 "name": "tatooine",
                 "surface_water": 5
            }
        }
     }
}

ruleSetMocks would contain one entry per data source you're trying to mock, and then you can specify the response data using the output section. We'll try specifying "surface water" to be a low value for use in our rules that reject desert planets.

Types of mocking permitted

  • output - specify response values from any data connector
  • nextRuleSetToRun - where should the workflow jump to after the current block is evaluated