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

[API][UI Script] Get selected tests


#1

Hi,

I search a way to get custom field of selected tests.
Is it possible to get ids of selected test it in another way than use App.Tests.getSelected function? After that I want to use get_test or get_tests methods (http://docs.gurock.com/testrail-api2/reference-tests) but they don’t return any custom fields. I can get custom fields from get_case request but it’s long way. Are there any way to get fields for few tests in one request?

It need to me to start our automation test for few test at once.

Thanks,
Dmitry


#2

Hello Dmitry,

Thanks for your posting! Using getSelected wouldn’t be recommended (as this is an internal API) but you can simply go through the table(s) and check for selected checkboxes (the “value” attribute contains the ID). The easiest way to implement your scenario would be to add the custom field directly to the tables and then filter for the column value instead of using the API functions. Would this also work for you?

Regards,
Tobias


#3

Hello Tobias,

If I right understand your idea is adding custom field to list of shown column and get values from markup. Yes it will be working. Little disadvantage of this solution is specific settings for view of tests list to pososbility get values.

Thank you for your advice,
Dmitry


#4

Hello Dmitry,

Yes, that’s the idea in this case and this would be the easiest way to implement this. Please let me know in case any questions come up, we are happy to help.

Regards,
Tobias