I'd like to execute a script to setup tests. It should be run once but only once if I start a single test manually or a testsuite or the whole project. (Whenever the execution starts.) I also need to handle the opposite event after all tests are over. I'm looking to somthing similar as the "[AssemblyInitialize]-Method" in .NET-unit tests. How can this be done?

3 Answers 3


SoapUI allows you define start-up and tear-down scripts for both test suites and tests withing a suite.

If you select either a a test suite or test in the GUI, you'll see tabs near the bottom of the screen. Select either Setup Script or TearDown Script and type your Groovy script in there.


In my opinion, you got 3 solutions:

  1. first is to edit directly testruner.sh/.bat, remember it will affect as well other projects.

  2. I'm not sure what you are trying to achieve, but at first glance, it seems you wish to pass login data (or something like that). If I'm right you may try soapUI's authorize options or "transfer step" to pass some data to other testcases.

  3. option: it's rather easy, but won't looks good. Reorganize test suits/test cases, in each test case add a groovy script (with a condition to not run the script if the process is already running), and on the last step add once


You can create a groovy script and put that in every stages that u want.

And to achieve to (It should be run once objective) Inside the groovy script make sure to put a condition to check whether that script run previously or no run yet, you can do it using set global variable and check that variable status inside the groovy script.

Ex- Set Project level custom property

Isrun = 0

in your groovy script

     //Run the script
     //Set Isrun to 1
}else if(${#Project#Isrun==1){
    // Do not run the script

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.