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

Get all test results for a given test case

Dear Experts,
I have an Excel list with all Test Case IDs of interest and their “status”.
The status of each test case is calculated by hand based on the test results for that test case.
Currently I have to go to the web ui, select my project -> search for a given test case id -> tests & results and analyse the results with the “must have” milestone.
Unfortunatelly I cannot see a way to establish a relation between test cases and test results via the API.
I would like to be able to show all test results for a given test case.
I thought about a workaround to search for all results for a given test run / test case combination.
So I am checking each test run / test case combination in my project but I cannot find the desired results even though they exist:
Test Case ID: 37739

Current Run ID: 1031

TestRail API returned HTTP 400("No (active) test found for the run/case combination.")

Current Run ID: 1028

TestRail API returned HTTP 400("No (active) test found for the run/case combination.")

Current Run ID: 1002

What does an “active” test mean?

My code:

public class TestMapper {
    public static void main(String[] args) throws Exception {
        APIClient client = new APIClient("<..>/testrail/");
        JSONArray runs = (JSONArray) client.sendGet("get_runs/91");
        String testCase = "37739";
        System.out.println("Test Case ID: " + testCase);
        for (int i = 0; i < runs.size(); i++) {
            JSONObject currentRun = (JSONObject) runs.get(i);
            System.out.println("Current Run ID: " + currentRun.get("id"));
            try {
                JSONArray results = (JSONArray) client.sendGet("get_results_for_case/" + currentRun.get("id") + "/" + testCase);

                for (int j = 0; j < results.size(); j++) {
                    JSONObject currentResults = (JSONObject) results.get(i);
            } catch (Exception e) {


Hi Zee,
the error message only says, that there is no instance of the case within the run given.

For the term active I’m not quite sure, but I guess it reflects a special issue. Via the API you would be able to get active test results only
If you delete a Test (having already a valid result) the result still exist in the DB, but is not shown in the UI. You can even add the test case again and the former results will be shown - at least ist was so in the past. I GUESS this is what TestRail calls active or incative test in a run.