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

Update test run description via UI script


#1

Is there a way to update test run description programmatically via UI script by certain clicking event? It would be great if there’s an example I could look over. On the other note, same question - how to update test run description via PHP api using update_plan_entry? An example would be really helpful.


#2

Hi Pratik,

You can use TestRail’s API for this but we wouldn’t recommend doing this via a UI Script and UI Scripts are mostly intended for smaller UI modifications (things like removing a button or adding a link). If the run is part of a plan, you can use update_plan_entry if the run/configuration reuses the description of the plan entry/group (and does not override it). For standalone runs, you can use update_run instead:

http://docs.gurock.com/testrail-api2/reference-plans
http://docs.gurock.com/testrail-api2/reference-runs

Cheers,
Tobias


#3

Hi Tobias,

How do you remove the button on test run page/level? This would serve the same purpose for me. Is there a UI script written somewhere for that?

I would like to remove the button from a page on certain clicking event of other button on the same test run page. So, I assume I would want to remove that button from that specific test run page and not all of them.

Assuming ^runs/overview won’t help me here.

Pratik


#4

Hi Pratik,

Which button would you like to remove? Removing buttons dynamically based on other events (such as clicking another button) is not really recommended because TestRail’s user interface and most pages are highly dynamic and select elements may be reloaded upon changes (and this might bring back a button, for example). UI Scripts and UI customizations should usually be limited to smaller modifications such as removing a button on the Test Runs & Results overview page which are less dynamic.

Cheers,
Tobias


#5

I hear you, Tobias. The button that I would like to remove is the custom button that I have created via UI script. However, I know this is not the best idea. Instead, I would update the description of that individual test run (which is a part of some test plan). I am planning on using update_plan_entry call via the UI script but finding it difficult to write one.

Is there any example on that specifically with UI script? I would hit the custom button on the test run page and using uiscripts.context.run.id, update the description of that specific test run. The idea is to put some description on that test run page letting us know in the FUTURE that we have already covered this test run for certain parameter checking(this is related to our specific project).

Pratik


#6

Hi Pratik,

Thanks for your reply. We have a generic UI script example that demonstrates how to access the API here:

You would need to enable session authentication under Administration > Site Settings > API but can then call every API method (including update_plan_entry) from a UI script.

I hope this helps!

Cheers,
Tobias