Reporting API
Get test results and artifacts via API
With mabl's reporting API, teams can programmatically export test results and test artifacts to an external reporting tool or database. The endpoints available in mabl's reporting API include:
- Run results endpoints to retrieve test results
- Batch results endpoint to retrieve a filtered batch of test runs
- Run artifacts endpoints to export test artifacts
This guide provides an overview of the reporting API endpoints.
Getting started
Before using mabl's reporting API, you need to create a Viewer API key, which is passed in the header to authenticate requests.
For example, the following cURL request for retrieving deployment event results authenticates with the -u
flag:
curl -s "https://api.mabl.com/execution/result/event/DEPLOYMENT-EVENT-ID"\
-u "key:YOUR-API-KEY"
API key permissions
Only workspace owners can create and copy API keys in mabl.
Run results endpoints
With the run results API endpoints, you can get the status and results for a test run, plan run, or deployment event and integrate them into an external reporting workflow for further analysis.
Some use cases for reporting mabl test run results to an external database include:
- Identifying flaky tests
- Analyzing trends in test frequency or pass rate over time
- Creating an internal dashboard with the current status of mabl test results for different teams, releases, and branches
To retrieve status and run out from the run results endpoints, send the request with the appropriate mabl resource IDs as parameters. The following table outlines each endpoint, its parameters, and its output.
Endpoint | Parameter | Output |
---|---|---|
Get test run results | Test run ID | Information about the result of a test run. |
Get plan run results | Plan run ID | Information about the result of a plan run. |
Get deployment event results | Deployment event ID | Information about the result of a deployment event. |
Batch results endpoint
In addition to getting the results of a specific test run, plan run, or deployment event, you can also get test results using the batch results endpoint. This endpoint returns a batch of test runs with filtering available for time range, test/plan labels, test ID, plan ID, application ID, environment ID.
Some use cases for the batch results endpoint include:
- Getting all runs from a workspace to initialize a databases with all existing results
- Getting specific stats on a recent release for ad-hoc analysis
Send the request with the workspace ID as a path parameter. By default, the endpoint returns all test runs in the cloud from the past 30 days. Runs are only available after a test completes and are usually available within a few seconds of test execution.
Note
Tests runs with a stopped or canceled status are not included in the response from the batch results endpoint.
To filter your results, you may supply additional query parameters in your request. For the parameters that take an ID as a value, provide the appropriate mabl resource ID:
Parameter | Description |
---|---|
application_id | Return results for a specific application by providing an application ID |
environment_id | Return results for a specific environment by providing an environment ID |
test_id | Return results for a specific test by providing a test ID |
test_label | Filter results by test label |
plan_id | Return results for a specific plan by providing a plan ID |
plan_label | Filter results by plan label |
earliest_start_time * | Earliest test run start time* in epoch milliseconds |
latest_end_time * | Latest test run end time* in epoch milliseconds |
limit | Maximum number of runs to return in a single response. Additional pages of results can be retrieved by passing the cursor parameter on a subsequent call. |
cursor | Use to additional results in a paginated response |
*The time range from earliest start time to latest end time cannot exceed 90 days. If you do not specify a time range, the default response returns test runs from the last 30 days.
Run artifacts endpoints
The run artifacts endpoints create and retrieve an export of artifacts for a specific test run, which can be useful for automatically exporting test run artifacts for auditing requirements.
The run artifacts endpoint can export the follow artifacts:
- Chrome traces
- Console logs
- DOM snapshots
- HAR logs
- Screenshots
These artifacts may also be exported in the mabl CLI with the command mabl test-runs export <test-run-id>
.
To create and retrieve an export of test run artifacts, you need to send the request with the appropriate mabl resource IDs as parameters. The following table outlines each run artifact endpoint, its parameters, and its output:
Endpoint | Parameters | Output |
---|---|---|
Create an export of test run artifacts | Test run ID | Creates an export of the test run artifacts and returns an export ID. |
Get test run artifacts export | Export ID | Polls the endpoint until the export is ready. When the export is complete, this endpoint returns a URL where you can access a zip file containing the export. |
Export URL access period
The export URL is only accessible for 7 days.
Updated 20 days ago