TestProject Forum

Getting execution report in gitlab ci

$ curl -X POST "https://api.testproject.io/v2/projects/<PROJECT_ID>/jobs/<JOB_ID>/run" -H "accept: application/json" -H "Authorization: <API_KEY>" -H "Content-Type: application/json" -d "{ \"agentId\": \"{Agetnt ID}\", \"queue\": true, \"restartDriver\": false,}"

I am using this command on GitLab ci to start the job execution on a remote agent and its working fine but I want to get and save the execution report after finished how can I do that

this is what I get when I run this command

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   109  100    31  100    78      7     19  0:00:04  0:00:03  0:00:01    27
{"id":"JWgnv71S902eJAIlLoebFw"}

so is there a way to make it wait for the execution to finish and then save the report?

Hello,
You can use the following endpoint to get last execution results in a wanted format (PDF/TP/JSON):

https://api.testproject.io/docs/v2/#/Reports/Reports_GetV2ProjectsByProjectIdTestsByTestIdReportsLatest

You can simply query this endpoint once every minute few minutes until the response you get matches the ID you got from previous step.

that is what i was going to do but i thought there might be a better solution

Thanks