Forum Discussion

pembertonrw's avatar
pembertonrw
Contributor
13 years ago

Calling Thread Safe Test Case From MockService

I am currently mocking out various web services that I need to test against and I am currently getting an issue when a test case is invoked in quick succession as the properties from the 1st request are being overwritten by the second. I have read the webpage (http://www.soapui.org/Functional-Testin ... tests.html) on how to create a thread-safe test case which is fine if you are running things from Test Cases. The mock Service calls different test cases depending on what values it receives from the incoming message. I have tried the example of the page however it doesn't seem that you can invoke the testRunner from within the mock service. The current code I am using is:

def project = context.mockService.project
def testCaseToRun = project.getTestSuiteByName("TestSuite1").getTestCaseByName("TestCase1")
def testStepToSet = testCaseToRun.getTestStepByName("001 - Create Properties")
testStepToSet.setPropertyValue("Value1", "Some Value")
testCaseToRun.run(new com.eviware.soapui.support.types.StringToObjectMap(), true)


I could create new test cases that have the "Run Testcase" action in them but that would make a lot of re-work, which I don't mind doing but I wanted to cover all options first.
No RepliesBe the first to reply