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

UI Script that accesses "Runs Completed"


Hey again,

I’m trying to write a few UI scripts. Is it possible for me to access the data that testruns accesses to read “Total Runs Completed”? Or if not that, access the “# of tests Passed. # Blocked” etc? I just want to have my script display this data elsewhere. Doesn’t matter where for now, just trying to access them in general.


As an update, I found out that making a variable var length = $('table.grid').length; was sufficient to find the total number of tests. I’m still looking for a way to find each element that is selected as a specific type of 'Passed" or “Failed” or “Blocked” though. I’ll update my post if I figure that part out on my own, but would love a tiny bit of help. (Perhaps if you know the element name for that field? :wink: )



Thanks for your posting. There is currently no easy way to access these numbers via JavaScript and UI scripts unfortunately. The total number of tests can be found out with the workaround you’ve mentioned but this only works if all tests are displayed on the page (which is not the case if you use the compact view mode, for example). The next update of TestRail will add additional meta data to the ‘uiscripts’ variable and this also includes test run properties etc. Currently not included in the update are the statistics of the test runs or test plans but I’ve just added this as a feature request and we will look into it, thanks!




Thanks for the response. I’ll use whatever stitch workarounds I can find and then change everything when TestRails v.3.0 comes out. They’ll work temporarily for my situation, which is okay for the time being.

Thanks again for the quick reply!


You are welcome and please let me know in case you have any further questions.