Forum Discussion

oleksii's avatar
Occasional Contributor
8 years ago

Stop load test suite execution from groovy script.



The first step in my test suite is SOAP ping request. I want to stop further test suite execution if ping step does not return "alive".

What I tried to do:

  • Add a groovy step after SOAP ping step which would validate ping response and run this (tried testRunner and other handlers; compare with "true" to make it executed - will change to false when I find a solution):
def groovyUtils = new context )
def holder = groovyUtils.getXmlHolder( "ping#Response" ) holder["//Message"]

if(holder["//Message"].contains('alive') == true) { "Test execution stopped as ping was unsuccessful."
	loadTestRunner.cancel("Test execution stopped as ping was unsuccessful.")
  • Tried to add the script above to teardown tab of the corresponding ping load test.

Neither of this worked - . Can anyone give me a piece of advice on how to accomplish this?

2 Replies

  • oleksii's avatar
    Occasional Contributor

    The more I work with SoapUI the more **bleep**ty it seems to me :(



    loadTestRunner.cancel( "Cancelling LoadTest" )

    being placed in load test setup script has no effect on load test execution at all. How to use it then??

    • rupert_anderson's avatar
      Valued Contributor



      Whilst SoapUI has its aged parts and rough edges, I prefer to think of them as opportunities for improvement! :-)


      In terms of your problem, if I am understanding you right you have something like:



      1.Soap Request (get ping result)

      2.Groovy TestStep (test ping result and conditionally stop load test)


      The above TestCase is then run from a load test.


      Could you instead maybe try to conditionally stop the load test from within the TestCase rather than in the Load Test's setup script? Maybe something like:


      if( context.LoadTestRunner!= null )
      context.LoadTestRunner.cancel( "Cancelling LoadTest" )


      Related post: