Forum Discussion

deggial's avatar
deggial
Occasional Contributor
13 years ago

Groovy script execution hangs in the middle of a test file

After successfully sending several thousands parametrized requests groovy script hangs and stop execution (CPU is 90% idle and more than 1 Gb Ram is free)

Need to restart SoapUI (4.5.1 Open Source) to be able to run anything again. Can you please advise if it's SoapUI bug or something wrong with the script?

Groovy test script:

 import com.eviware.soapui.impl.wsdl.teststeps.*

def testDataSet = []
def fileName = "C:\\Users\\xxx\\Desktop\\testdata.csv"

new File(fileName).eachLine { line -> testDataSet.add( line.split(",") ) }

for ( i in testDataSet ) {

def myProps = new java.util.Properties();
myProps = testRunner.testCase.getTestStepByName("Properties");

myProps.setPropertyValue("parameter1",i[0]);
myProps.setPropertyValue("parameter2",i[1]);
myProps.setPropertyValue("parameter3",i[2]);

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def testCase = testRunner.testCase;

def testStep = testCase.getTestStepByName("myWSRequest");
testStep.getTestRequest().setUsername(myProps.getPropertyValue("username"))
testStep.getTestRequest().setPassword(myProps.getPropertyValue("password"))

testRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testCase, null);
testStepContext = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext(testStep);
testStep.run(testRunner, testStepContext);

}


References:

http://www.loadui.org/forum/viewtopic.php?f=5&t=15500#p37045
http://balur-sangamesh.blogspot.com/2012/05/groovy-read-write-values-from-csv-file.html
http://thewonggei.wordpress.com/2010/08/05/configure-http-basic-auth-once-for-soapui-test-suties/
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    Just curious, why are you creating a new TestRunner and Context object every time instead of passing in the existing instances available in the script step?
  • deggial's avatar
    deggial
    Occasional Contributor
    Thanks for pointing that out, looks much better now. Moved everything out of the loop except for property setting and step execution.