Forum Discussion
Also I'm not sure what this is supposed to do:
def contextMap = new StringToObjectMap( context ) def calledTestRun = myTestCase.run(contextMap,false); def myContext = calledTestRun.getRunContext()
I would have thought that this is just creating two references to the same object:
assert contextMap.is(myContext)
Isn't it?
Thanks for your response JHunt. Yes, both variables should point to the same one. I didn't realise that the contextMap passed on to the run() method is itself getting updated after the test case is run.
I will try out your solution and post the response.
EDIT: I guess you have removed part of your advice from the above post. Shouldn't context.setProperty('token', somevalue) work from the called test case and caller extract it using contextMap.getProperty('token')?
Actually, it's not true, they are different objects.
Sorry, it's taking me a bit to get my head around what you are doing.
I think you were on the right track with the "Run Test Case" step, but the problem you had was that you wanted with the ThreadIndex to go through.
Give me a few minutes.
Here's how you can implement something similar to what the "Run Test Case" test step is doing. In fact, I pinched this from the Source Code in:
src/main/java/com/eviware/soapui/impl/wsdl/teststeps/WsdlRunTestCaseTestStep.java
FIrst, add this method to your script :
import com.eviware.soapui.SoapUI; import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase import com.eviware.soapui.config.TestCaseConfig import com.eviware.soapui.config.LoadTestConfig; private WsdlTestCase createTestCase(WsdlTestCase testCase) { testCase.beforeSave(); try { TestCaseConfig config = TestCaseConfig.Factory.parse(testCase.getConfig().xmlText()); config.setLoadTestArray(new LoadTestConfig[0]); WsdlTestCase wsdlTestCase = testCase.getTestSuite().buildTestCase(config, true); wsdlTestCase.afterLoad(); return wsdlTestCase; } catch (Throwable e) { SoapUI.logError(e); } return null; }
And then in the code you posted, replace
def myTestCase = myTestSuite.getTestCaseByName("Login")
by:
def myTestCase = createTestCase( myTestSuite.getTestCaseByName("Login") )
This should fix your threading issues!