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

400 Bad Request, response on when creating a new test run from API call


I am creating a new Test Run, by passing the necessary details in the hash map as below.

HashMap<Object, Object> runmap = new HashMap<Object, Object>();
			runmap.put(Keywords.SuiteID.getValue(), TESTSUITE_ID);
			runmap.put(Keywords.Name.getValue(), "New UI - Automation Run for Showcase Demo");
			runmap.put(Keywords.AssignTo.getValue(), USERID_TOASSIGN);
			runmap.put(Keywords.IncludeAll.getValue(), false);
			runmap.put(Keywords.CaseIds.getValue(), result);
JSONObject testrun = (JSONObject) client.sendPost(APIEndpoints.ADD_RUN.getCommand() + PROJECT_ID, run_map);

the runmap looks like this,
{include_all=false, case_ids=[2506235,2506232,2506234,2506236,2506231,2506237,2506240,2506241,2506242,2506243,2506244,2506245,2506246,2572924,2572924,2506721,2506728,2506233,2507958,2507959,2507960,2507961,2507962,2506229,2506230], name=New UI - Automation Run for Showcase Demo, assignedto_id=1125, suite_id=14018}

and the request looks like this,

All the IDs (Project, Suite, and Cases) are valid. But still, i am getting a 400 Bad request response.

Is there a limit on a number of test cases that can be added?

Please help me on this.


Hi Hemanth,

Thanks for your posting. sendPost and the API binding expect objects and you would need to use Boolean, Integer and List objects instead of bool, int and arrays. Examples can be found here:

I hope this helps!