Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

I've been doing testing with SoapUI testrunner.sh script recently and have come across a very peculiar behaviour. If you run a specific test case, testrunner.sh will not execute the Groovy Setup Script for the test suite that the test case belongs to. However at the same time if you enable response capture and don't specify the test suite, the test suite name will appear as a part of the request/response file name. It seems that SoapUI is still processing the test suite, just not running any of its setup code.

My setup scripts were simple for the purpose of this post, they simply logged a message...
 Groovy
Test Suite -
log.info("== Test Suite Setup ==")
Test Case -
log.info("== Test Case Setup ==")


When I ran the test case with this command:
 Command
testrunner.sh -a -s TestSuite1 -c TestCase1 -e https://some_server:8001/context_root/service_uri -r soapui-project.xml


...all I saw in the logs was the message from my test case setup script...
 Log
[SoapUITestCaseRunner] Running TestCase [TestCase1]
[log] == Test Case Setup ==
[SoapUITestCaseRunner] Running SoapUI testcase [TestCase1]


The test suite setup is not executed. However if I leave the test case out and just run the test suite as a whole like so:
 Command
testrunner.sh -a -s TestSuite1 -e https://some_server:8001/context_root/service_uri -r soapui-project.xml


...the output changed to...
 Log
[SoapUITestCaseRunner] Running TestSuite [TestSuite1], runType = SEQUENTIAL
[log] == Test Suite Setup ==
[log] == Test Case Setup ==
[SoapUITestCaseRunner] Running SoapUI testcase [TestCase1]


Both the test suite and test case setup scripts are executed.



According to SoapUI Support, "This is not necessarily a limitation." However I would argue that this is indeed a huge limitation and that the test suite setup should be executed every time a test case is run.

Here's a screenshot of my setup in case the above is not clear. The same behaviour is observed in the SoapUI GUI.
soapui_groovy1.png


There really is no good workaround for this apart from putting your setup code into the test case or running the entire test suite every time.

-i

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.