Automation Runs

The automation/runs namespace provides API methods for automation runs and threads. You can use these methods to retrieve automation runs and threads for a project, create new runs and threads, submit test results (including custom fields, artifacts & links) and finally mark runs and threads as completed.

GET /projects/{project_id}/automation/runs

Returns all automation runs for a project.

This method uses pagination so you might need to request additional pages to retrieve all automation runs.

Request

This method supports the following expands so you can automatically include additional information for referenced objects:

  • automation_sources

  • configs

  • milestones

  • statuses

  • users

Response

GET /api/v1/projects/1/automation/runs
200 OK
{
    "page": 1,
    "prev_page": null,
    "next_page": 2,
    "last_page": 2,
    "per_page": 100,
    "total": 150,
    "result": [
        {
            "id": 1,
            "project_id": 1,
            "name": "Run 1",
            "status": 2,
            ..
            "is_completed": false,
            "untested_count": 0,
            "status1_count": 90,
            "status2_count": 10,
            "status3_count": 0,
            "status4_count": 0,
            "status5_count": 0,
            "status6_count": 0,
            "status7_count": 0,
            "status8_count": 0,
            "status9_count": 0,
            "status10_count": 0,
            "status11_count": 0,
            "status12_count": 0,
            "status13_count": 0,
            "status14_count": 0,
            "status15_count": 0,
            "status16_count": 0,
            "status17_count": 0,
            "status18_count": 0,
            "status19_count": 0,
            "status20_count": 0,
            "status21_count": 0,
            "status22_count": 0,
            "status23_count": 0,
            "status24_count": 0,
            "success_count": 90,
            "failure_count": 10,
            "completed_count": 100,
            "total_count": 100,
            "thread_count": 8,
            "thread_active_count": 2,
            "thread_completed_count": 6,
            "created_at": "..",
            "created_by": 2,
            "updated_at": null,
            "updated_by": null,
            "completed_at": null,
            "completed_by": null
        },
        {
            "id": 2,
            "project_id": 1,
            "name": "Run 2",
            "status": 3,
            ..
            "is_completed": true,
            "untested_count": 1,
            "status1_count": 20,
            "status2_count": 5,
            "status3_count": 0,
            "status4_count": 0,
            "status5_count": 0,
            "status6_count": 0,
            "status7_count": 0,
            "status8_count": 0,
            "status9_count": 0,
            "status10_count": 0,
            "status11_count": 0,
            "status12_count": 0,
            "status13_count": 0,
            "status14_count": 0,
            "status15_count": 0,
            "status16_count": 0,
            "status17_count": 0,
            "status18_count": 0,
            "status19_count": 0,
            "status20_count": 0,
            "status21_count": 0,
            "status22_count": 0,
            "status23_count": 0,
            "status24_count": 0,
            "success_count": 20,
            "failure_count": 5,
            "completed_count": 25,
            "total_count": 26,
            "thread_count": 8,
            "thread_active_count": 2,
            "thread_completed_count": 6,
            "created_at": "..",
            "created_by": 2,
            "updated_at": null,
            "updated_by": null,
            "completed_at": "..",
            "completed_by": 1
        },
        ..
    ],
    "expands": {
        ..
    }
}

Examples

// Get latest 100 automation runs for project with ID 5
GET /api/v1/projects/5/automation/runs

// Get second result page (pagination)
GET /api/v1/projects/5/automation/runs?page=2

// Get latest 100 automation runs
GET /api/v1/projects/5/automation/runs

// Get latest 100 failed automation runs
GET /api/v1/projects/5/automation/runs?state=3

// Get latest automation runs created after a certain date & time
GET /api/v1/projects/5/automation/runs?created_after=2023-02-15T00:00:00.000Z

// Get automation runs and include expands
GET /api/v1/projects/5/automation/runs?expands=automation_sources,configs,users

Status codes

200 400 401 403 422 (details)

GET /automation/runs/{automation_run_id}

Returns a single automation run.

Request

This method supports the following expands so you can automatically include additional information for referenced objects:

  • automation_sources

  • configs

  • milestones

  • statuses

  • users

Response

GET /api/v1/automation/runs/1
200 OK
{
    "result": {
        "id": 1,
        "project_id": 1,
        "name": "Run 1",
        "status": 2,
        ..
        "is_completed": false,
        "untested_count": 0,
        "status1_count": 90,
        "status2_count": 10,
        "status3_count": 0,
        "status4_count": 0,
        "status5_count": 0,
        "status6_count": 0,
        "status7_count": 0,
        "status8_count": 0,
        "status9_count": 0,
        "status10_count": 0,
        "status11_count": 0,
        "status12_count": 0,
        "status13_count": 0,
        "status14_count": 0,
        "status15_count": 0,
        "status16_count": 0,
        "status17_count": 0,
        "status18_count": 0,
        "status19_count": 0,
        "status20_count": 0,
        "status21_count": 0,
        "status22_count": 0,
        "status23_count": 0,
        "status24_count": 0,
        "success_count": 90,
        "failure_count": 10,
        "completed_count": 100,
        "total_count": 100,
        "thread_count": 8,
        "thread_active_count": 2,
        "thread_completed_count": 6,
        "created_at": "..",
        "created_by": 2,
        "updated_at": null,
        "updated_by": null,
        "completed_at": null,
        "completed_by": null
    },
    "expands": {
        ..
    }
}

Examples

// Get the automation run with ID 5
GET /api/v1/automation/runs/5

// Get a automation run and include expands
GET /api/v1/automation/runs/1?expands=automation_sources,configs,users

Status codes

200 400 401 403 404 422 (details)

POST /projects/{project_id}/automation/runs

Creates a new automation run in a target project in preparation for adding threads and test results.

Request

Example

POST /api/v1/projects/1/automation/runs
{
    "name": "Run 1",
    "source": "frontend",
    "tags": [
        "tag-a",
        "tag-b"
    ],
    "artifacts": [
        {
            "name": "Artifact 1.png",
            "url": "https://example.com/artifact1.png",
            "mime_type": "image/png",
            "size": 1048576
        }
    ],
    "fields": [
        {
            "name": "Field 1",
            "type": 4,
            "value": ".."
        }
    ],
    "links": [
        {
            "name": "Link 1",
            "url": "https://example.com"
        }
    ]
}

Returns the ID of the created automation run on success:

201 Created
{
    "id": 1
}

Status codes

201 400 401 403 404 422 (details)

POST /automation/runs/{automation_run_id}/append

Appends test artifacts, fields or links to an existing automation run.

Request

Example

POST /api/v1/automation/runs/1/append
{
    "artifacts": [
        {
            "name": "Artifact 1.png",
            "url": "https://example.com/artifact1.png",
            "mime_type": "image/png",
            "size": 1048576
        }
    ],
    "fields": [
        {
            "name": "Field 1",
            "type": 4,
            "value": ".."
        }
    ],
    "links": [
        {
            "name": "Link 1",
            "url": "https://example.com"
        }
    ]
}
204 No Content

Status codes

204 400 401 403 404 422 (details)

POST /automation/runs/{automation_run_id}/complete

Marks an automation run and its threads as completed and closes it for new threads and test results.

Request

Example

POST /api/v1/automation/runs/1/complete
{
    "measure_elapsed": true
}
204 No Content

Status codes

204 400 401 403 404 422 (details)

POST /automation/runs/{automation_run_id}/threads

Creates a new thread in an automation run in preparation for adding test results.

Request

Example

POST /api/v1/automation/runs/1/threads
{
    "elapsed_observed": 600000000,
    "artifacts": [
        {
            "name": "Artifact 1.png",
            "url": "https://example.com/artifact1.png",
            "mime_type": "image/png",
            "size": 1048576
        }
    ],
    "fields": [
        {
            "name": "Field 1",
            "type": 4,
            "value": ".."
        }
    ]
}

Returns the ID of the created thread on success:

201 Created
{
    "id": 1
}

Status codes

201 400 401 403 404 422 (details)

POST /automation/runs/threads/{automation_run_thread_id}/append

Appends test artifacts, fields or test results to an existing thread in an automation run.

Request

Example

POST /api/v1/automation/runs/threads/1/append
{
    "elapsed_observed": 600000000,
    "artifacts": [
        {
            "name": "Artifact 1.png",
            "url": "https://example.com/artifact1.png",
            "mime_type": "image/png",
            "size": 1048576
        }
    ],
    "fields": [
        {
            "name": "Field 1",
            "type": 4,
            "value": ".."
        }
    ],
    "tests": [
        {
            "key": "5ccaaa9ca9f351d0c36b45c59728f1a23d16601d",
            "name": "Test 1",
            "folder": "Folder A",
            "status": "passed",
            "elapsed": 60000000,
            "file": "test.js",
            "line": 100,
            "assertions": 20,
            "artifacts": [
                {
                    "name": "Artifact 1.png",
                    "url": "https://example.com/artifact1.png",
                    "mime_type": "image/png",
                    "size": 1048576
                }
            ]
        },
        {
            "key": "7295b69b0df06d518d481c54d71973f9f911520a",
            "name": "Test 2",
            "folder": "Folder A",
            "status": "passed"
        },
        {
            "key": "db0003c47b7565af20cacd3370f8152fd02b5a00",
            "name": "Test 3",
            "folder": "Folder B",
            "status": "failed",
            "fields": [
                {
                    "name": "Error",
                    "type": 4,
                    "value": "..",
                    "meta": {
                        "type": "NullPointerException"
                    },
                    "is_highlight": true
                }
            ]
        },
        ..
    ]
}
204 No Content

Status codes

204 400 401 403 404 422 (details)

POST /automation/runs/threads/{automation_run_thread_id}/complete

Marks an automation run thread as completed and closes it for new test results.

Request

Example

POST /api/v1/automation/runs/threads/1/complete
{
    "elapsed_observed": 600000000
}
204 No Content

Status codes

204 400 401 403 404 422 (details)

Last updated