Forum Discussion

mkliba's avatar
mkliba
Occasional Contributor
15 years ago

How to run two Test Cases in parallel using a groovy

Hi:

Imagine I have a test suite TS with 3 TC's, TC, TC1 and TC2. In TC I'd like to write a groovy that launch both TC's, TC1 and TC2 in parallel. When both TC's execution are finished, I'd like to run a second groovy on TC. I have been trying on the lauch groovy with:

def properties = new com.eviware.soapui.support.types.StringToObjectMap()
testRunner.testCase.testSuite.project.testSuites["TS"].testCases["TC1"].run(properties,false)
testRunner.testCase.testSuite.project.testSuites["TS"].testCases["TC2"].run(properties,false)

But this run TC1 first, wait for it to finish and then run TC2. Then the second groovy is executed.

Is there any way I can ensure both, TC1 and TC2 are launch at the same time and when they finished continue with the next groovy step?

thanks in advance,
Michel
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    I think just setting the async parameter of run() to true will do it:

    [tt:o8ndnnnc]testRunner.testCase.testSuite.project.testSuites["TS"].testCases["TC1"].run(properties,true)
    testRunner.testCase.testSuite.project.testSuites["TS"].testCases["TC2"].run(properties,true)[/tt:o8ndnnnc]
    • SOAPUICrazy's avatar
      SOAPUICrazy
      New Contributor

      In SOAP UI 5.2.1 , by default each request is waiting for response and then it is executing the other.

       

      Actually we are trying to push the REST request continuously for every 5 sec once without waiting for response in sequential manner.

      Because each Request is taking 25 sec for getting response - where our test scenario is getting failed.

       

      Is there is any option to disable the REST response or to reduce the wait time?

       

      Could anyone help with the option.

       

       

      Thanks and Regards,

      SOAPUI Crazy

  • mkliba's avatar
    mkliba
    Occasional Contributor
    You were absolutely right. Thanks a lot!
  • mkliba's avatar
    mkliba
    Occasional Contributor
    M McDonald:

    If I'd like to do a similar thing with to TestStep, how can I do it? I mean, run two TestSteps in parallel by TestStep name.

    Thanks.
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    I don't think you can do that without handling the threading yourself. There is a TestCase.run() method but it does not have an async parameter.
  • mkliba's avatar
    mkliba
    Occasional Contributor
    I guess you mean getTestStepByName.run instead of testCases.run not having an async parameter right? Where can I get a detailed documentation for this stuff?

    And by the way, if you look at my original post, I was looking also to find a way on my first groovy to monitor when the 2 TC's running in parallel have finished. Is there any way to do that?

    Thanks,
    Michel
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    I guess you mean getTestStepByName.run


    Well, getTestStepByName() returns an object that implements the TestStep interface, but I guess you could say that.

    The APIs for the free version are all public, just google "soapui api".

    If you upgrade to the Pro version you'll get access to the Pro part of the Eviware forum and additional nifty features.
  • AbDon's avatar
    AbDon
    New Contributor
    Hi,

    So, Is there a way to run a test step asynchronously using groovy without getting into threading ?

    I need to run a couple of test steps asynchronously.
    On running the next test step, response gets posted to the above test steps.

    Rgds,
    Ab.