# Test runs

Executing tests and getting result

## Returns list of historical TestRuns

> Returns list of historical TestRuns

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[{"name":"Test runs","description":"Executing tests and getting result"}],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"PaginatedV2TestRunList":{"type":"object","required":["count","results"],"properties":{"count":{"type":"integer"},"next":{"type":"string","nullable":true,"format":"uri"},"previous":{"type":"string","nullable":true,"format":"uri"},"results":{"type":"array","items":{"$ref":"#/components/schemas/V2TestRun"}}}},"V2TestRun":{"type":"object","properties":{"browserName":{"type":["string","null"],"readOnly":true},"browserVersion":{"type":["string","null"],"readOnly":true},"browserHeight":{"type":["integer","null"],"readOnly":true},"browserWidth":{"type":["integer","null"],"readOnly":true},"stepsRuns":{"type":"string","readOnly":true},"userId":{"type":["string","null"],"format":"uuid","readOnly":true},"duration":{"type":["string","null"],"readOnly":true},"ended":{"type":["string","null"],"format":"date-time","readOnly":true},"errorCode":{"type":["string","null"],"readOnly":true},"extensionVersion":{"type":["string","null"],"readOnly":true},"id":{"type":"string","format":"uuid","readOnly":true},"name":{"type":"string","readOnly":true},"osName":{"type":["string","null"],"readOnly":true},"queued":{"type":["string","null"],"format":"date-time","readOnly":true},"runMode":{"enum":["server","local","recording"],"type":"string","description":"* `server` - cloud\n* `local` - local\n* `recording` - recording","readOnly":true},"runProfileId":{"type":["string","null"],"format":"uuid","readOnly":true},"screenSizeType":{"enum":["desktop","mobile","custom"],"type":"string","description":"* `desktop` - Desktop\n* `mobile` - Mobile\n* `custom` - Custom","readOnly":true},"sequence":{"type":["integer","null"],"readOnly":true},"started":{"type":["string","null"],"format":"date-time","readOnly":true},"status":{"enum":["error","passed","failed","running","auto_retrying","stopped","queued","paused","skipped","recording","initialized"],"type":"string","description":"* `error` - Error\n* `passed` - Passed\n* `failed` - Failed\n* `running` - Running\n* `auto_retrying` - Auto Retrying\n* `stopped` - Stopped\n* `queued` - Queued\n* `paused` - Paused\n* `skipped` - Skipped\n* `recording` - Recording\n* `initialized` - Initialized","readOnly":true},"suiteRunId":{"type":["string","null"],"format":"uuid","readOnly":true},"testId":{"type":["string","null"],"format":"uuid","readOnly":true},"triggeredBy":{"enum":["user","api","webhook","scheduler","github","cli","agent"],"type":"string","description":"* `user` - User\n* `api` - Api\n* `webhook` - Webhook\n* `scheduler` - Scheduler\n* `github` - Github\n* `cli` - Cli\n* `agent` - Agent","readOnly":true},"webappUrl":{"type":"string","readOnly":true}},"required":["browserHeight","browserName","browserVersion","browserWidth","duration","ended","errorCode","extensionVersion","id","name","osName","queued","runMode","runProfileId","screenSizeType","sequence","started","status","stepsRuns","suiteRunId","testId","triggeredBy","userId","webappUrl"]}}},"paths":{"/api/v2/testruns/":{"get":{"operationId":"v2_testruns_list","description":"Returns list of historical TestRuns","summary":"Returns list of historical TestRuns","parameters":[{"in":"query","name":"ordering","schema":{"type":"string","enum":["-started","started"]},"description":"Sort list by param"},{"name":"page","required":false,"in":"query","description":"A page number within the paginated result set.","schema":{"type":"integer"}},{"name":"page_size","required":false,"in":"query","description":"Number of results to return per page.","schema":{"type":"integer"}},{"in":"query","name":"started_after","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"started_before","schema":{"type":"string","format":"date-time"}},{"in":"query","name":"status","schema":{"type":"string","enum":["auto_retrying","error","failed","initialized","passed","paused","queued","recording","running","skipped","stopped"]},"description":"* `error` - Error\n* `passed` - Passed\n* `failed` - Failed\n* `running` - Running\n* `auto_retrying` - Auto Retrying\n* `stopped` - Stopped\n* `queued` - Queued\n* `paused` - Paused\n* `skipped` - Skipped\n* `recording` - Recording\n* `initialized` - Initialized"},{"in":"query","name":"test_id","schema":{"type":"string","format":"uuid"}}],"tags":["Test runs"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedV2TestRunList"}}},"description":""},"401":{"description":"Authentication credentials were missing or invalid."}}}}}}
```

## Execute desired test

> Execute desired test.

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[{"name":"Test runs","description":"Executing tests and getting result"}],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"V2RunTest":{"type":"object","properties":{"testId":{"type":"string","format":"uuid"},"runProfileId":{"type":["string","null"],"format":"uuid"},"variables":{"type":["array","null"],"items":{"$ref":"#/components/schemas/V2OverrideVariable"},"default":[]}},"required":["testId"]},"V2OverrideVariable":{"type":"object","properties":{"key":{"type":"string","maxLength":128},"value":{"type":["string","null"]}},"required":["key"]},"V2TestRunStatus":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"finishedSteps":{"type":"integer","readOnly":true},"modified":{"type":"string","format":"date-time","readOnly":true},"status":{"enum":["error","passed","failed","running","auto_retrying","stopped","queued","paused","skipped","recording","initialized"],"type":"string","description":"* `error` - Error\n* `passed` - Passed\n* `failed` - Failed\n* `running` - Running\n* `auto_retrying` - Auto Retrying\n* `stopped` - Stopped\n* `queued` - Queued\n* `paused` - Paused\n* `skipped` - Skipped\n* `recording` - Recording\n* `initialized` - Initialized","readOnly":true},"totalSteps":{"type":"integer","readOnly":true},"webappUrl":{"type":"string","readOnly":true}},"required":["finishedSteps","id","modified","status","totalSteps","webappUrl"]}}},"paths":{"/api/v2/testruns/":{"post":{"operationId":"v2_testruns_create","description":"Execute desired test.","summary":"Execute desired test","tags":["Test runs"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2RunTest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2TestRunStatus"}}},"description":""},"400":{"description":"Request body failed validation."},"401":{"description":"Authentication credentials were missing or invalid."}}}}}}
```

## Retrieve test run result

> Returns single object.

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[{"name":"Test runs","description":"Executing tests and getting result"}],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"V2TestRun":{"type":"object","properties":{"browserName":{"type":["string","null"],"readOnly":true},"browserVersion":{"type":["string","null"],"readOnly":true},"browserHeight":{"type":["integer","null"],"readOnly":true},"browserWidth":{"type":["integer","null"],"readOnly":true},"stepsRuns":{"type":"string","readOnly":true},"userId":{"type":["string","null"],"format":"uuid","readOnly":true},"duration":{"type":["string","null"],"readOnly":true},"ended":{"type":["string","null"],"format":"date-time","readOnly":true},"errorCode":{"type":["string","null"],"readOnly":true},"extensionVersion":{"type":["string","null"],"readOnly":true},"id":{"type":"string","format":"uuid","readOnly":true},"name":{"type":"string","readOnly":true},"osName":{"type":["string","null"],"readOnly":true},"queued":{"type":["string","null"],"format":"date-time","readOnly":true},"runMode":{"enum":["server","local","recording"],"type":"string","description":"* `server` - cloud\n* `local` - local\n* `recording` - recording","readOnly":true},"runProfileId":{"type":["string","null"],"format":"uuid","readOnly":true},"screenSizeType":{"enum":["desktop","mobile","custom"],"type":"string","description":"* `desktop` - Desktop\n* `mobile` - Mobile\n* `custom` - Custom","readOnly":true},"sequence":{"type":["integer","null"],"readOnly":true},"started":{"type":["string","null"],"format":"date-time","readOnly":true},"status":{"enum":["error","passed","failed","running","auto_retrying","stopped","queued","paused","skipped","recording","initialized"],"type":"string","description":"* `error` - Error\n* `passed` - Passed\n* `failed` - Failed\n* `running` - Running\n* `auto_retrying` - Auto Retrying\n* `stopped` - Stopped\n* `queued` - Queued\n* `paused` - Paused\n* `skipped` - Skipped\n* `recording` - Recording\n* `initialized` - Initialized","readOnly":true},"suiteRunId":{"type":["string","null"],"format":"uuid","readOnly":true},"testId":{"type":["string","null"],"format":"uuid","readOnly":true},"triggeredBy":{"enum":["user","api","webhook","scheduler","github","cli","agent"],"type":"string","description":"* `user` - User\n* `api` - Api\n* `webhook` - Webhook\n* `scheduler` - Scheduler\n* `github` - Github\n* `cli` - Cli\n* `agent` - Agent","readOnly":true},"webappUrl":{"type":"string","readOnly":true}},"required":["browserHeight","browserName","browserVersion","browserWidth","duration","ended","errorCode","extensionVersion","id","name","osName","queued","runMode","runProfileId","screenSizeType","sequence","started","status","stepsRuns","suiteRunId","testId","triggeredBy","userId","webappUrl"]}}},"paths":{"/api/v2/testruns/{id}/":{"get":{"operationId":"v2_testruns_retrieve","description":"Returns single object.","summary":"Retrieve test run result","parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid"},"description":"A UUID string identifying this test run.","required":true}],"tags":["Test runs"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2TestRun"}}},"description":""},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Resource not found."}}}}}}
```

## List test run debug artifacts

> Returns list of debug artifacts attached to the test run.

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[{"name":"Test runs","description":"Executing tests and getting result"}],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"DebugArtifact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"kind":{"enum":["uploaded_file","logs_partial","logs","cloud_logs","container_stats","chrome_debug_logs","extension_network_logs","extension_network_logs_partial","report","dom_snapshot","visual_regression_screenshot"],"type":"string","description":"* `uploaded_file` - Uploaded File\n* `logs_partial` - Logs Partial\n* `logs` - Logs\n* `cloud_logs` - Cloud Logs\n* `container_stats` - Container Stats\n* `chrome_debug_logs` - Chrome Debug Logs\n* `extension_network_logs` - Extension Network Logs\n* `extension_network_logs_partial` - Extension Network Logs Partial\n* `report` - Report\n* `dom_snapshot` - Dom Snapshot\n* `visual_regression_screenshot` - Visual Regression Screenshot","readOnly":true,"title":"Artifact kind"},"file":{"type":"string"},"expirationTime":{"type":["string","null"],"format":"date-time","readOnly":true,"description":"None for eternal"}},"required":["expirationTime","file","id","kind"]}}},"paths":{"/api/v2/testruns/{id}/debug-artifacts/":{"get":{"operationId":"v2_testruns_debug_artifacts_list","description":"Returns list of debug artifacts attached to the test run.","summary":"List test run debug artifacts","parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid"},"description":"A UUID string identifying this test run.","required":true}],"tags":["Test runs"],"responses":{"200":{"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DebugArtifact"}}}},"description":""},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Resource not found."}}}}}}
```

## Retrieve test run debug artifact by kind

> Returns a single debug artifact of the given kind attached to the test run.

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[{"name":"Test runs","description":"Executing tests and getting result"}],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"DebugArtifact":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"kind":{"enum":["uploaded_file","logs_partial","logs","cloud_logs","container_stats","chrome_debug_logs","extension_network_logs","extension_network_logs_partial","report","dom_snapshot","visual_regression_screenshot"],"type":"string","description":"* `uploaded_file` - Uploaded File\n* `logs_partial` - Logs Partial\n* `logs` - Logs\n* `cloud_logs` - Cloud Logs\n* `container_stats` - Container Stats\n* `chrome_debug_logs` - Chrome Debug Logs\n* `extension_network_logs` - Extension Network Logs\n* `extension_network_logs_partial` - Extension Network Logs Partial\n* `report` - Report\n* `dom_snapshot` - Dom Snapshot\n* `visual_regression_screenshot` - Visual Regression Screenshot","readOnly":true,"title":"Artifact kind"},"file":{"type":"string"},"expirationTime":{"type":["string","null"],"format":"date-time","readOnly":true,"description":"None for eternal"}},"required":["expirationTime","file","id","kind"]}}},"paths":{"/api/v2/testruns/{id}/debug-artifacts/{artifact_type}/":{"get":{"operationId":"v2_testruns_debug_artifacts_retrieve","description":"Returns a single debug artifact of the given kind attached to the test run.","summary":"Retrieve test run debug artifact by kind","parameters":[{"in":"path","name":"artifact_type","schema":{"type":"string","enum":["chrome_debug_logs","cloud_logs","container_stats","dom_snapshot","logs","logs_partial"]},"description":"Debug artifact type.","required":true},{"in":"path","name":"id","schema":{"type":"string","format":"uuid"},"description":"A UUID string identifying this test run.","required":true}],"tags":["Test runs"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DebugArtifact"}}},"description":""},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Artifact not found"}}}}}}
```

## Download test run logs

> Download the logs for the selected test run.

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[{"name":"Test runs","description":"Executing tests and getting result"}],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}}},"paths":{"/api/v2/testruns/{id}/logs/":{"get":{"operationId":"v2_testruns_logs_retrieve","description":"Download the logs for the selected test run.","summary":"Download test run logs","parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid"},"description":"A UUID string identifying this test run.","required":true}],"tags":["Test runs"],"responses":{"302":{"description":"Redirect to logs file"},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Logs not found or expired"}}}}}}
```

## Download JUnit XML report

> Download the JUnit XML report for the selected test run.

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[{"name":"Test runs","description":"Executing tests and getting result"}],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}}},"paths":{"/api/v2/testruns/{id}/report/junit/":{"get":{"operationId":"v2_testruns_report_junit_retrieve","description":"Download the JUnit XML report for the selected test run.","summary":"Download JUnit XML report","parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid"},"description":"A UUID string identifying this test run.","required":true}],"tags":["Test runs"],"responses":{"200":{"content":{"application/json":{"schema":{"type":"string","format":"binary"}}},"description":"JUnit XML report file"},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Resource not found."}}}}}}
```

## Get test run steps screenshots

> Returns all screenshots.

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[{"name":"Test runs","description":"Executing tests and getting result"}],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"V2TestRunScreenshots":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"stepsRuns":{"type":"array","items":{"$ref":"#/components/schemas/V2StepRunScreenshot"},"readOnly":true}},"required":["id","stepsRuns"]},"V2StepRunScreenshot":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"stepId":{"type":["string","null"],"format":"uuid","readOnly":true},"screenshotUrl":{"type":"string"}},"required":["id","screenshotUrl","stepId"]}}},"paths":{"/api/v2/testruns/{id}/screenshots/":{"get":{"operationId":"v2_testruns_screenshots_retrieve","description":"Returns all screenshots.","summary":"Get test run steps screenshots","parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid"},"description":"A UUID string identifying this test run.","required":true}],"tags":["Test runs"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2TestRunScreenshots"}}},"description":""},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Resource not found."}}}}}}
```

## Get test run status

> Returns single object.

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[{"name":"Test runs","description":"Executing tests and getting result"}],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"V2TestRunStatus":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"finishedSteps":{"type":"integer","readOnly":true},"modified":{"type":"string","format":"date-time","readOnly":true},"status":{"enum":["error","passed","failed","running","auto_retrying","stopped","queued","paused","skipped","recording","initialized"],"type":"string","description":"* `error` - Error\n* `passed` - Passed\n* `failed` - Failed\n* `running` - Running\n* `auto_retrying` - Auto Retrying\n* `stopped` - Stopped\n* `queued` - Queued\n* `paused` - Paused\n* `skipped` - Skipped\n* `recording` - Recording\n* `initialized` - Initialized","readOnly":true},"totalSteps":{"type":"integer","readOnly":true},"webappUrl":{"type":"string","readOnly":true}},"required":["finishedSteps","id","modified","status","totalSteps","webappUrl"]}}},"paths":{"/api/v2/testruns/{id}/status/":{"get":{"operationId":"v2_testruns_status_retrieve","description":"Returns single object.","summary":"Get test run status","parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid"},"description":"A UUID string identifying this test run.","required":true}],"tags":["Test runs"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2TestRunStatus"}}},"description":""},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Resource not found."}}}}}}
```

## Stop running test run

> Stop test run

```json
{"openapi":"3.1.0","info":{"title":"BugBug.io Public API","version":"v2"},"tags":[{"name":"Test runs","description":"Executing tests and getting result"}],"security":[{"tokenAuth":[]},{"Bearer":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token-based authentication with required prefix \"Token\""}},"schemas":{"V2TestRunStatus":{"type":"object","properties":{"id":{"type":"string","format":"uuid","readOnly":true},"finishedSteps":{"type":"integer","readOnly":true},"modified":{"type":"string","format":"date-time","readOnly":true},"status":{"enum":["error","passed","failed","running","auto_retrying","stopped","queued","paused","skipped","recording","initialized"],"type":"string","description":"* `error` - Error\n* `passed` - Passed\n* `failed` - Failed\n* `running` - Running\n* `auto_retrying` - Auto Retrying\n* `stopped` - Stopped\n* `queued` - Queued\n* `paused` - Paused\n* `skipped` - Skipped\n* `recording` - Recording\n* `initialized` - Initialized","readOnly":true},"totalSteps":{"type":"integer","readOnly":true},"webappUrl":{"type":"string","readOnly":true}},"required":["finishedSteps","id","modified","status","totalSteps","webappUrl"]}}},"paths":{"/api/v2/testruns/{id}/stop/":{"post":{"operationId":"v2_testruns_stop_create","description":"Stop test run","summary":"Stop running test run","parameters":[{"in":"path","name":"id","schema":{"type":"string","format":"uuid"},"description":"A UUID string identifying this test run.","required":true}],"tags":["Test runs"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2TestRunStatus"}}},"description":""},"400":{"description":"Request body failed validation."},"401":{"description":"Authentication credentials were missing or invalid."},"404":{"description":"Resource not found."}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bugbug.io/public-api-reference/test-runs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
