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

TestRail API Parameter Issue


Hello ,
I am trying to add test result into testRail using java + TestNG .
and I am successfully done that but some how i am not able to give proper value in actual result and content .
below is my code

Map data = new HashMap();
data.put(“case_id”, new Integer(36540));
data.put(“status_id”, new Integer(1));
data.put(“expected”, expected);
data.put(“elapsed”, “5m”);
data.put(“title”, title);
data.put(“actual”, “Login Passed”);

List list = new ArrayList();
Map d = new HashMap();
d.put(“results”, list);

client.sendPost(“add_results_for_cases/347”, d);

I am able to mark the test case as pass but not able to add actual result and contect parameter …

API to get list of all Test Runs assigned to a specific Test Plan
API to get list of all Test Runs assigned to a specific Test Plan

Hi Dhaval,

Thanks for your posting. Are you trying to submit separate steps for your test results? If so, you would need to format the steps as follows with the API:

(expand Request example, JSON syntax)

You can also find an example for Java here:


        Hello tobis ,

Thanks for your instant action please find the below updated code

        List StepResult = new ArrayList();
	Map data = new HashMap();
	Map Step1 = new HashMap();
	Step1.put("status_id", new Integer(1));
	Step1.put("actual", expected);
	Step1.put("expected", expected);
	data.put("case_id",  new Integer(36540));
	data.put("status_id", new Integer(1));
	data.put("comment", "Working as per the Release not instruction");
	List temp = new ArrayList();
	Map d = new HashMap();
	d.put("results", temp);
        client.sendPost("add_results_for_cases/347", d);

which gives me generates below json file can you please guide me further …
results= [
custom_steps_separated= [
actual=system should allows to logged in,
expected=system should allows to logged in,
content=Login into application
comment=Working as per the Release not instruction
I want to give actual result with test result but :worried:


Hi Dhaval,

Thanks for your reply. The structure looks good actually. Can you please check if the case actually supports separated steps, i.e. is the template of the case set to “Test Case (Steps)”? Is the system name of the custom field correct?



Hello Tobias,

which field you are talking means is Test Step field name .
in my TestRail is try to add result manually and notice the firebug and i found the below json

custom_step_results:[{“content”:"Login into application "
“expected”:"system should allows to logged in ",
“actual”:“Good to know”}]

So and i try with both result and separated but not working in my case


Hi Dhaval,

Sorry, the field needs to be called custom_step_results with the add_result methods. custom_step_separated is only for add_case / update_case etc. and custom_step_results is the equivalent for test results.

I hope this helps!



Hello Tobias,

It looks like a typo mistake in “custom_step_results”

Thanks for your valuable time and support .

thanks for Sharing the Separator method knowledge as well surely I ll use further .

Truly appreciated.

Thanks !!!



You are welcome, Dhaval!