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

Bulk-unassign tests via API


#1

Hi,

I am in need to bulk-unassign a group of tests via the API, to indicate that nobody needs to look at them anymore.
I am trying to do that with add_results API call, as discussed in Assign tests via the API
However, when I send a request like

{
	"results": [
		{
			"test_id": 101,
			"assignedto_id": null,
		}
}

I get the error: “Field :results contains one or more invalid result…of Status ID, Assigned To or Comment is required)”

I tried with “assignedto_id” set to 0, -1, ‘unassign’, but with no help.

How can achieve test bulk-unassign via the API?

Thanks,
Ludovico


#2

We also need this usage and UI can do this. Anyone know how to do this?


#3

Or we might need to create a dummy account “no-body” and assign to it. But, why UI can do this…


#4

For a single test you can use the add_result API with a POST

I have found that you cannot just provide a new {assignedto_id}; you also need a {comment} or a {status_id}

The following was executed in Java but it should work from any language. The JSON payload is:

{“comment” : “Reset assignedto_id”, “assignedto_id” : null}

1509465525773 https://rivington.testrail.net/index.php?/api/v2/add_result/28
Going to send the following data: {“comment” : “Reset assignedto_id”, “assignedto_id” : null}
Response Code : 200
Input line: {“id”:36,“test_id”:28,“status_id”:null,“created_by”:1,“created_on”:1509465527,“assignedto_id”:null,“comment”:“Reset assignedto_id”,“version”:null,“elapsed”:null,“defects”:null,“custom_step_results”:null}

1509465526661 Finished in 888 millisecond(s)


#6

After further investigation, it turns out that, although the add_result API accepts null as a valid {assignedto_id} and responds with a response code 200 and passes back a well formed JSON response for the result instance, it does not un-assign the underlying test entity. If a non null {assignedto_id} value is provided it does propagate that value to the underlying test record. The ability to bulk assign appears not to be possible through the API.


#7

Generally - unless the API documentation explicitly states it can be done, it is not possible or at least the API is not designed to do it.