# Test Automation

The following endpoints enable you to use the Test Automation feature programmatically.

# Quick reference

Type Resource Description
POST /api/test_cases/run_requests Run test cases.
GET /api/test_cases/run_requests/{id} Get the current state of a test case run request.
GET /api/recipes/{recipe_id}/test_cases Get test cases.

# Run test cases

Use this endpoint to run test cases. You can specify the test cases to run in the following ways:

  • All test cases of all recipes in a manifest
  • All test cases of all recipes in a project
  • All test cases of all recipes in a folder
  • All test cases belonging to a particular recipe
  • Test cases you specify

This endpoint is asynchronous. You can use the run request id to poll the current state of the request using the /api/test_cases/run_requests/{id} endpoint.

POST /api/test_cases/run_requests

# Request body

Name Type Description
manifest_id integer optional Run test cases for all recipes in the export manifest you specify.
project_id integer optional Run test cases for all recipes in the project you specify. Use the list projects endpoint to retrieve the IDs of all projects in your workspace.
folder_id integer optional Run test cases for all recipes in the folder you specify.
recipe_id integer optional Run all test cases for the recipe you specify.
test_case_ids array of strings optional Run specific test cases by ID.

# Sample request

curl  -X POST https://www.workato.com/api/test_cases/run_requests \
      -H 'Authorization: Bearer <api_token>' \
      -H 'Content-Type: application/json' \
      -d '{
            "manifest_id": "0"
          }'

# Sample response

{
  "data": {
    "id": "cirr-AHNFkza6-dwMArc",
    "status": "running",
    "user": {
      "id": 0
    },
    "created_at": "2023-06-01T01:40:00.000-07:00",
    "updated_at": "2023-06-01T01:40:00.000-07:00",
    "results": [
      {
        "recipe": {
          "id": 0,
          "name": "string"
        },
        "test_case": {
          "id": "citc-AG48N4xo-g6ccgP",
          "name": "string"
        },
        "job": {
          "id": "j-AHNFpnRa-sMWLYJ"
        },
        "status": "pending"
      }
    ]
  }
}

# Get the current state of a test case run request

Get the current state of a test case run request. For completed requests, Workato also returns the test coverage data along with the results.

GET /api/test_cases/run_requests/{id}

# URL parameters

Name Type Description
id string required The run request's ID.

# Sample request

curl  -X GET https://www.workato.com/api/test_cases/run_requests/{id} \
      -H 'Authorization: Bearer <api_token>' 

# Sample response

{
  "data": {
    "id": "cirr-AHNFkza6-dwMArc",
    "status": "completed",
    "user": {
      "id": 0
    },
    "created_at": "2023-06-01T01:40:00.000-07:00",
    "updated_at": "2023-06-01T01:40:00.000-07:00",
    "coverage": {
      "value": 87.5,
      "total_actions_count": 8,
      "total_visited_actions_count": 7,
      "recipes": [
        {
          "id": 0,
          "version_no": 0,
          "coverage": {
            "value": 87.5,
            "not_visited_actions": [
              {
                "step_number": 4
              }
            ]
          }
        }
      ]
    },
    "results": [
      {
        "recipe": {
          "id": 0,
          "name": "string"
        },
        "test_case": {
          "id": "citc-AG48N4xo-g6ccgP",
          "name": "string"
        },
        "job": {
          "id": "j-AHNFpnRa-sMWLYJ"
        },
        "status": "succeeded"
      }
    ]
  }
}

# Get test cases

Returns a collection of test cases belonging to the recipe you specify.

GET  /api/recipes/{recipe_id}/test_cases

# URL Parameters

Name Type Description
recipe_id integer required The ID of the recipe you plan to retrieve test case details from.

# Sample request

curl  -X GET https://www.workato.com/api/recipes/{recipe_id}/test_cases \
      -H 'Authorization: Bearer <api_token>'

# Sample response

{
  "data": [
    {
      "id": "citc-AG48N4xo-g6ccgP",
      "created_at": "2023-06-01T01:40:00.000-07:00",
      "updated_at": "2023-06-01T01:40:00.000-07:00",
      "description": "string",
      "name": "string"
    }
  ]
}


Last updated: 2/2/2024, 6:55:32 PM