Forum Discussion

dusura's avatar
dusura
New Contributor
16 years ago

Is it possible to run test cases with mock response steps in parallel?

Hi,

I am trying to test web services with asynchronous behaviour. Using test cases with mock responses seems like a neat way to achieve this.

So I have a several test cases, each with the following steps:
1) mock response (response is acknowledging receipt of request)
2) delay (simulate doing some work)
3) test request (asynchronous "reply" to the original request)

Each test case is for a separate operation of the same web service. I need to run them in parallel as I don't know which test case will occur first. But there seems to be no way to do this. Each mock response wants to listen on the same endpoint exclusively.

Any suggestions would be much appreciated.

Cheers,
David

1 Reply

  • dusura's avatar
    dusura
    New Contributor
    I thought I'd post my solution. I used one mock service instead of many separate tests. I used a groovy script for my mock response which starts a test case asynchronously. The test case has a built in delay to simulate "doing some work".

    def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
    def holder = groovyUtils.getXmlHolder(mockRequest.requestContent)

    holder.declareNamespace( 'ns', 'http://my.namespace.com/')
    def contextId = holder.getNodeValue("//ns:ContextId")

    context.mockService.project.getTestSuiteByName("Replies").getTestCaseByName("Asynch Reply").run(new com.eviware.soapui.support.types.StringToObjectMap( [ contextId : contextId ]), true)