Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

Missing results for test in API response for /get_results_for_run


#1

Hi All,

I’ve got a problem with /get_results_for_run in TestRail API.

The case is:

  1. I’ve created test run of id: 202 with some tests.
  2. Response for /get_tests/202 shows listing of tests, also the one that i’m looking for:

{
“id”: 223332,
“case_id”: some_case_id,
“status_id”: 1,
“assignedto_id”: some_assignee_id,
“run_id”: 202,
“title”: “Title”,
“template_id”: 1,
“type_id”: 7,
“priority_id”: 2,
“estimate”: null,
“estimate_forecast”: null,
“refs”: null,
“milestone_id”: null,
“custom_device”: null,
“custom_preconds”: null,
“custom_steps”: null,
“custom_expected”: null,
“custom_steps_separated”: null,
“custom_mission”: null,
“custom_goals”: null,
“custom_test_set_type”: []
},

  1. I don’t want to hit API too many times, so i’m using GET /get_results_for_run/202 to get results. For test_id 223332 I get:

{
“id”: 48005,
“test_id”: 223332,
“status_id”: 1,
“created_by”: 9,
“created_on”: 1502366103,
“assignedto_id”: null,
“comment”: null,
“version”: null,
“elapsed”: null,
“defects”: null,
“custom_step_results”: null
},
Please note that there’s only one result for such test_id=223332

  1. I can see more results (3, one of them is user assignment) in Test Rail UI, so I use GET /get_results/223332:

[
{
“id”: 48005,
“test_id”: 223332,
“status_id”: 1,
“created_by”: 9,
“created_on”: 1502366103,
“assignedto_id”: null,
“comment”: null,
“version”: null,
“elapsed”: null,
“defects”: null,
“custom_step_results”: null
},
{
“id”: 46481,
“test_id”: 223332,
“status_id”: 1,
“created_by”: 14,
“created_on”: 1502131782,
“assignedto_id”: null,
“comment”: null,
“version”: null,
“elapsed”: null,
“defects”: null,
“custom_step_results”: null
},
{
“id”: 46472,
“test_id”: 223332,
“status_id”: null,
“created_by”: 14,
“created_on”: 1502131771,
“assignedto_id”: 14,
“comment”: null,
“version”: null,
“elapsed”: null,
“defects”: null,
“custom_step_results”: null
}
]

Why /get_results_for_run/ call returns only one of 3 results? At first I thought it’s just the last result for test, but for e.g. test_id: 223276 I get no results (but it’s marked as Passed) and for test_id: 223672 there are 2 results returned, so I’m quite confused about such API behaviour:

{
        "id": 46688,
        "test_id": 223672,
        "status_id": 1,
        "created_by": 14,
        "created_on": 1502235385,
        "assignedto_id": null,
        "comment": null,
        "version": null,
        "elapsed": null,
        "defects": null,
        "custom_step_results": null
    },
    {
        "id": 46686,
        "test_id": 223672,
        "status_id": null,
        "created_by": 14,
        "created_on": 1502235378,
        "assignedto_id": 14,
        "comment": null,
        "version": null,
        "elapsed": null,
        "defects": null,
        "custom_step_results": null  },   

Thanks,
Chris


#2

Hi Chris,

Thanks for your post! The get_results_for_run method would always return all results, however keep in mind that these would be ordered by creation date (created_by), and not grouped by the test id (test_id). So while it may look like there is only one result, it’s likely that there is actually still multiple results and you would have to check the full API response in order to find the other results at the time they were submit. Hope this helps to clarify this!

Regards,
Marco


#3

Hi Marco,

Thanks for your answer! I’ve searched for other results in full API response and they were not there - that’s why I started this topic. This is a blocker for my work, may I contact you directly or should I reach out to Gurock Support?

Regards,
Chris


#4

Hi Chris,

Thanks for your reply! The API method would return the full list of results in the response, so if you don’t see this then it could be another issue. You can contact us directly at contact@gurock.com, and I’m happy to help troubleshoot the issue. You can just send in a screenshot of the test with the multiple results and also a full copy of the API response that you receive, and we can troubleshoot from there. Looking forward to your email!

Regards,
Marco