selkind
16 years agoOccasional Contributor
Having troubles running a load test from a Groovy script
I'm trying to do a single load test that has two phases to the test. To do this, I'm creating a separate "Master Test case" with a load test whose setup script invokes the load test from another test case, then executes a load test made up of the test case(s) within the "Master".
The script is below. First I find the Test Suite object by navigating up the hierarchy, then navigate back down to get the load test I want. Printing out the names shows I'm getting the right objects.
However, when I invoke the run method, that load test does not execute, and in fact the run method returns null. (I was getting an exception trying to invoke the hasStopped() method, so I added the log statement on the Runner's name and now get "Tue Mar 16 14:31:17 EDT 2010:ERROR:An error occured [Cannot get property 'name' on null object], see error log for details" in the log).
Can anyone spot what I'm doing wrong here?
This is soapUI 3.5, downloaded yesterday.
Thanks in advance for any help.
masterLoadTest = loadTestRunner.loadTest
parentTestCase = masterLoadTest.parent
parentTestSuite = parentTestCase.parent
parentProject = parentTestSuite.parent
log.info "----------------------"
log.info "masterLoadTest: " + masterLoadTest.name
log.info "parentTestCase: " + parentTestCase.name
log.info "parentTestSuite: " + parentTestSuite.name
log.info "parentProject: " + parentProject.name
warmUpTC = parentTestSuite.getTestCaseByName("SmallDoc FourStreamWarmup TC")
warmUpLT = warmUpTC.getLoadTestByName("FourStreamSmall Warmup LT")
log.info("Running warmup LT: " + warmUpLT.name)
stoMap = new StringToObjectMap()
warmUpLTRunner = warmUpLT.run(stoMap, false)
log.info warmUpLTRunner.name
while (!warmUpLTRunner.hasStopped()) {
java.io.Thread.sleep(1000)
}
log.info("Done with warmup")[/font:1tyzvnjv]
The script is below. First I find the Test Suite object by navigating up the hierarchy, then navigate back down to get the load test I want. Printing out the names shows I'm getting the right objects.
However, when I invoke the run method, that load test does not execute, and in fact the run method returns null. (I was getting an exception trying to invoke the hasStopped() method, so I added the log statement on the Runner's name and now get "Tue Mar 16 14:31:17 EDT 2010:ERROR:An error occured [Cannot get property 'name' on null object], see error log for details" in the log).
Can anyone spot what I'm doing wrong here?
This is soapUI 3.5, downloaded yesterday.
Thanks in advance for any help.
masterLoadTest = loadTestRunner.loadTest
parentTestCase = masterLoadTest.parent
parentTestSuite = parentTestCase.parent
parentProject = parentTestSuite.parent
log.info "----------------------"
log.info "masterLoadTest: " + masterLoadTest.name
log.info "parentTestCase: " + parentTestCase.name
log.info "parentTestSuite: " + parentTestSuite.name
log.info "parentProject: " + parentProject.name
warmUpTC = parentTestSuite.getTestCaseByName("SmallDoc FourStreamWarmup TC")
warmUpLT = warmUpTC.getLoadTestByName("FourStreamSmall Warmup LT")
log.info("Running warmup LT: " + warmUpLT.name)
stoMap = new StringToObjectMap()
warmUpLTRunner = warmUpLT.run(stoMap, false)
log.info warmUpLTRunner.name
while (!warmUpLTRunner.hasStopped()) {
java.io.Thread.sleep(1000)
}
log.info("Done with warmup")[/font:1tyzvnjv]