Forum Discussion

EBaethke's avatar
EBaethke
Contributor
11 years ago

Custom Script: Project Search within SoapUI

As you've all probably noticed, SoapUI doesn't have any built-in search mechanism. So I've created a script that will search the Project and output results to the Script Log and thought I'd share with you all.

It works by looking up the files directly using Java and performing a line-by-line search. I then use some regex to identify the Test Case, Test Suite, Resource, etc. location of each search result. It works for both composite (multi-file) and regular (single-file) projects.



**Note: for now the setting: "WSDL Settings >> Pretty Print Project Files" must be enabled. But if you played around with my regex you could probably fix that.

You should be able to import this test case anywhere into your project.
I've tried this out in SoapUI and SoapUIPro, seems to work in both with no issues.


Definitely let me know if you have any comments/questions

3 Replies

  • To some extent: yes.
    However, doing a regular text search will just give you the location of each result and a line number.
    This isn't super helpful if you want to know which TestSuite/TestCase/TestStep that the result is in. If you want to know that, then you'd have to search backwards inside the document and look for a tag like "<con:testStep ... name=". Its doable, but kind of a pain.

    My script looks-up and displays the TestSuite/TestCase/TestStep location of each search result automatically, which is pretty helpful.

    While I'm at it: I've attached a slightly newer version.
  • SiKing's avatar
    SiKing
    Community Expert
    I agree!
    I should have specified that I use grep for exactly the purpose you suggested, however all my SoapUI projects are composite - each test case is a separate file.
    The kind of search function that I personally would like to see, would allow for searches such as "all test cases that have disabled assertions", "all test cases that have <2 assertions", etc. Maybe someday I will write something like that.