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

Creating a UI script that can search in the References and Defects fields and select all the testcases with that same value


#1

Hi Tobias,
sorry again to bother you.
I wanted to create a UI script that clicking on a Button labelled " Start Searching", will select all the testcases in a Test Run that has got a specific text ( to be indicated in a input box) in the fields “References” and" Defects".
This is what I did till now:

name: Trigger for searching tests
description: Trigger search tests by input tickets
author:
version: 1.0
includes: ^runs/view
excludes:

js:
$(document).ready(

                          function() {
                                                       /* Create the button */
                                                       var button = $('<div class="toolbar content-header-toolbar"><a class="toolbar-button toolbar-button-last toolbar-button-first content-header-button button-start" href="javascript:void(0)">Start Searching</a></div>');

                                                       /* Create the inputbox */

   
                                                       /* Add them to the toolbar */
                                                       $("#content-header .content-header-inner").prepend(button);
          
                                       
                                                       /* Bind the click event to trigger the searching */
                                                       $("a", button).click(
                                       
                                                                      function()
                                                                      {
                                                                                                   $.ajax(
                                                                                                   {
                                                                                                   });
                                                                                                   return false;
                                                                      }
                                                       );
                          }

);

I’m too sure what is the best way to add the input box and how to trigger the result search plus selection after clicking the button. Please can you recommend the best way to proceed with this UI script development ?

Many thanks,
Giuseppe


#2

Hi Giuseppe,

Thanks for your posting! This is not something that can be covered via UI scripts because this would require some server-side logic to find those cases. We would recommend using the filters on the Select Cases dialog to base your case selection on fields like References (and referenced issues).

Cheers,
Tobias


#3

Hi Tobias,
thanks so much for your continuos support.
Actually I wanted to search both for References and Defects that are not both available in the Filter option ( I see References, but I don’t see Defects, is there any way to add it ?).
I was working on creating a UI script that has too parse the text in the webpage ( I don’t need to access the Database). What I generally put in these fields is a 4 digits number like 8456, that is the redmine ticket number. The necessity is that when we have to do a release testing, given the Ids of the Redmine tickets fixed by the developers, I want to filter into a Testrun and extract all the testcases that have those Ticket Ids in the fields Defects and References, so I can get what needs to be re-tested straight away,
Do you believe there’s any way to get that ?

Thanks a lot,
Giuseppe


#4

Hi Giuseppe,

Thanks for your reply. Such a UI script would be really complex and only work in some cases. For example, you would always need to have the References and Defects columns enabled (and this is configurable per user). You would also need to have all tests visible at the same time and this is something that’s not really practical for larger test runs and most users/teams use the single-section view. Instead of using a UI script, you can also find your issues with a simple browser search (Ctrl+F) and then select the rows/tests manually while going through the test run.

Cheers,
Tobias