Exporting test results

Running custom analysis on test results or displaying them along with other data on a personalized dashboard can be useful. You can achieve that by exporting the test results from one or more test runs or plans in a structured json format.

By fetching details about test runs and results, you can use powerful analytical tools to get insights about your testing efforts, or simply display your testing progress in external tools, i.e.:

  • Analyze test results in a BI tool
  • Display test results on operational dashboards

Getting test runs

You may want to to fetch your test execution data from TestRail to display it or process it in any manner. If you only need an overview of test execution, such as how many tests passed or failed for a set of test runs, you can perform a request similar to the one below.

Request Request Body Example Response Body Example

GET index.php?/api/v2/get_runs/{project_id}

curl -X GET \ 
  -u "user@example.com:password" \ 
  "https://example.testrail.io/index.php?/api/v2/get_runs/27"

Filtering test runs using query parameters

  • All active test runs for project with ID 1 created by user with ID 1 or 2:
    GET index.php?/api/v2/get_runs/1&is_completed=0&created_by=1,2

Getting test run results

In case you want to analyze and get insights on results for all your test cases, you can get the results on a per test run basis. This allows you to have more granular control over test results.

Request Request Body Example Response Body Example

GET index.php?/api/v2/get_results_for_run/{run_id}

curl -X GET \ 
  -u "user@example.com:password" \ 
  "https://example.testrail.io/index.php?/api/v2/get_results_for_run/228"

Filtering test results using query parameters

  • The latest 10 results for test run with ID 1 created by user 5
    GET index.php?/api/v2/get_results_for_run/1&created_by=5&limit=10

 

Was this article helpful?
3 out of 9 found this helpful