How to get information about flaky and slowest tests via the insights API

When wanting to manually analyze test result data, you can use our API's Job Artifact Endpoint to get the raw data for your builds.

Here is an example of how to use this endpoint:

curl --request GET \
--url \
--header "Circle-Token: $CIRCLE_TOKEN"

In order to use the API, you will need to create a personal API token and store it under an environment variable if running it in a build, or in your own environment if running it locally. In the above example, it will need to be stored as an environment variable called CIRCLE_TOKEN

You will also need to set the url for the API request which follows this format:{project-slug}/{job-number}/tests 

If the request is successful, you will get test metadata back in the following JSON format:

"items": [
"message": "",
"source": "",
"run_time": "",
"file": "",
"result": "",
"name": "",
"classname": ""
"next_page_token": "string"

By compiling the above data from your jobs, you can gain an insight which tests may be flaky or taking the longest to complete.

Was this article helpful?
0 out of 0 found this helpful



Article is closed for comments.