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

Assign tests via the API


#1

Hi guys,

We have created a plan generator that automagically creates test plans based on certain attributes that apply to test cases, which is working quite well.

The way we work is that when we create a regression test plan, we split up the work based on who is the Test Owner. There may be multiple test owners in a given suite, and we have many test suites, so ideally we would like to do this via the API’s instead of the TestRail frontend.

I was wondering if you are planning on implementing / know of a way to assign test cases via the API? That would enable us to assign the test cases to the person who owns the test at the time that / after the plan is generated. The “tests” API description only seems to have get methods available.

Thanks!

Glenn


#2

Pretty sure you want the add_plan_entry or update_plan_entry methods under Plans. As far as I can tell assignments are at the run level and not at the test level.


#3

Yes, I am using both of those methods to add the plans, however assigning at the test run level is not sufficient for our needs.


#4

Hello Glenn,

Thanks for your posting. You can assign single tests via the add_result/add_result_for_case API functions (via the assignedto_id argument), e.g.:

{ “assignedto_id”: 3 } // ID of the respective user

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

To assign all tests of a run, you can use the assignedto_id argument for add_run/add_plan as Logan already mentioned (thank you!).

Please let me know in case you have any further questions.

Regards,
Tobias


#5

Thanks Tobias!!!


#6

You are welcome, Glenn!


#7

Hi Tobias,

I finally got around to implementing the above per-case auto assignment via the API.

Unfortunately, aside from being quite slow (we have 3300+ tests in our test plan), everybody got spammed via the email notification system once per test assignment. In other words, TestRail sent out 3300+ emails!

I think this functionality may need to be re-looked at in light of the above.

Thanks,

Glenn


#8

Hello Glenn,

Thanks for the update, that’s appreciated. You can look into using the (quite new) add_results API which was specifically added for mass-adding results/test changes:

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

add_results also wouldn’t create and send email notifications.

Regards,
Tobias


Bulk-unassign tests via API
#9

Thanks Tobias - that API works much better for our needs :cool:


#10

Good to hear that this works for you!

Regards,
Tobias