With mabl's reporting API, teams can programmatically export test results, test artifacts, and workspace activity 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
- Activity feed results endpoint to export user activity in the workspace
Getting started
To authenticate your requests, follow authentication steps outlined in the Intro to the mabl API guide.
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 |
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 database 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.
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 retrieve 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 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. |
The export URL is only accessible for 7 days.
Activity feed results endpoint
The activity feed results endpoint returns results for historical user activity in your workspace. Results can be filtered for the time range, type of action, entity type, entity name, and actor ID. You can use this endpoint to export results to an internal database, dashboard, or reporting tool to track workspace activity.
Send the request with the workspace ID as a path parameter.
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 |
---|---|
action_type |
The type of action taken: "create", "update", "delete", or "recover" |
entity_type |
The type of object that was acted on, such as "test" or "snippet". Go to Settings > Activity Feed and click on the "Entity Type" dropdown to see a full list of supported entities. |
entity_name |
The name of the entity that was acted on. This field is case sensitive and returns results based on any name the entity has had, including entity names that were later updated. |
actor_id |
The user who performed the action - can be a user ID, API key ID, or the mabl system. |
start_time |
Earliest activity start time in epoch milliseconds |
end_time |
Latest activity end time in epoch milliseconds |
limit |
Maximum number of results 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 retrieve additional results in a paginated response |