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

Unable to update a case id with the result

Hi,
This is my understanding :

  1. Test cases are independent entities which are reusable
  2. Test plan has many test runs
  3. Test runs has many test cases included in it.
  4. We can add results(pass, fail, etc) for individual test cases under test runs.

Now coming to the problem,

url1: https://myorg.testrail.io/index.php?/runs/view/1325&group_by=tests:status_id&group_order=asc&group_id=3

url2:
https://myorg.testrail.io/index.php?/tests/view/947100&group_by=tests:status_id&group_order=asc&group_id=3

here 1325 is the run id and 947100 is testcase id.
Currently It has got 1 test case, if i click on it, i’ll be rediredcted to url2.

My API:
Map data = new HashMap();
data.put(“status_id”, new Integer(1));
data.put(“comment”, “This test worked fine!”);
JSONObject r = (JSONObject) client.sendPost(“add_result_for_case/1325/947100”, data);

But my test case is not getting updated.
I am getting this response:
Exception in thread “main” com.gurock.APIException: TestRail API returned HTTP 400(“Field :case_id is not a valid test case.”)

How to update a testcase under a testrun ?

Is the Test Case ID (947100 ) the ID shown in the Test Case Id when viewing the Case in the Test Case/Suites tab? If so - then it is the incorrect Test Case Id. When a test case from the Test Case/Suites tab is added to a run it is copied and gets a new Test Case Id associated with it. It is the second Test Case Id you need to update…

Thanks BGanger for suggesting,
Please expand the collapsed screenshot for full view.

Please observe the screenshots:
first screenshot is when i click on a particular test run - It has many test individual tests. the arrow is pointing to T914474, So when i click on that test, screenshot-2 appears (Meaning : T914474 is a test included in test run 1269)
Now when i click on edit in screenshot, parent test is opened whose id is c4748

  1. I cannot update testresult of a individual test.
  2. I have to update a test under a particular test run
    In my case : test run is 1269 and test result to be updated for T914474
    So this is what i do:
    JSONObject r = (JSONObject) client.sendPost(“add_result_for_case/1269/914474”, data);

But i get this response:
TestRail API returned HTTP 400(“Field :case_id is not a valid test case.”)

So, Please tell me how to update that test(914474) under the test run(1269).