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 https://circleci.com/api/v2/project/gh/CircleCI-Public/api-preview-docs/123/tests \
--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:
https://circleci.com/api/v2/project/{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.
Comments
Article is closed for comments.