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

Confused to add the result to test cases

#1

Hi there
I am new for TestRail. i have read the document how to add the test result to TestRail, but it looks like failed all 4 test cases if one of the test faild.

client.SendPost("add_result_for_case/1/1", testResult); 
client.SendPost("add_result_for_case/1/2", testResult); 
client.SendPost("add_result_for_case/1/3", testResult); 
client.SendPost("add_result_for_case/1/4", testResult); 

Could some one show me what is the right format to pass the right result to TestRail please.

0 Likes

#2

Hello Shiliang,

Thank you for posting! We generally are not able to troubleshoot any specifics with custom API scripts as part of our support, unfortunately (as we don’t have any professional services teams on hand to help review your code). We typically recommend reaching out to a member of your team with more experience in writing API scripts or using a general programming question/answer site such as Stack Overflow for assistance with this type of custom API script.

The add_result_for_case API method expects the test run ID and test case ID to be passed. In this example, the results will be added to test cases 1-4 in test run 1. Based on the code snippet you have provided, this API script is passing the same result to each of the 4 tests in test run 1 (which is shown in the attached screenshot). You would need to review the API script to make sure you are passing the appropriate test results to the proper tests.

I hope this helps!

Regards,
John

0 Likes

#3

Could you please provide a sample code just base on my example for Test Run R1 with 4 test cases T1-T4 please. i just need a example, with my code it actually pass test result to it, but not on right cases.

0 Likes

#4

Hi Shiliang,

We do not have any full sample API scripts available at the moment. However, each of the API binding docs has a basic example using the add_result_for_case API method in the ‘Example: POST request’ section of the page. All of the API binding documentation can be found on our website here:

http://docs.gurock.com/testrail-api2/start

We would also recommend reviewing the request example and POST fields that are supported for this to make sure you have the proper syntax, which is outlined here:

http://docs.gurock.com/testrail-api2/reference-results#add_result_for_case

Please note the add_result_for_case API method uses the same request example and fields as the add_result method.

I hope this helps!

Regards,
John

0 Likes