Forum Discussion

Dheepha's avatar
Dheepha
Contributor
12 years ago

How to execute soapui test cases parallel and in one go

Hi Team,

I have a requirement like below:
I have 10 test cases created under a test suite and I wanted to execute all the test in one go. i.e all the test should be executed at the same time against the defined endpoint.

But all the test executed in sequential way i.e test case 1, test case2 ... test case 10.

Even i tried using load test, there also execution happened in sequential way.

Can anyone tell me how to execute multiple test cases in one short i.e all the request should start execution at the same time in SOAPUI tool.

Advance thanks.

Regards,
Dheepha V

5 Replies

  • PaulDonny's avatar
    PaulDonny
    Regular Contributor
    So this seems to be an interesting one for me personally.

    There is many issues here, running TestSteps from multiple different TestCases will be difficult and SoapUI is not exactly designed to handle this. For best results, the Test Steps should be in the same TestCase in order for SoapUI to give you 'proper' results (IE, being able to see what actually happened), this can of course be bypassed by scripting a logger function and if inclined, a GUI.

    As for running these concurrently, this is going to be much more difficult than you might imagine. I will give you a basic script to get you started though.



    def testSuite = testRunner.testCase.testSuite;
    //Get all test cases in the testSuite
    for (TestCases in testSuite.getTestCaseList()) {
    //Get all Soap type test steps within the testCases
    for ( testStep in TestCases.getTestStepsOfType(com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep.class)){
    //Print out the name for the testStep
    log.info testStep.getName();
    //If it's not disabled, run it
    if (!testStep.isDisabled()) {
    //Set the TestRunner to the respective TestCase
    TestRunner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(TestCases, null);
    //Start multithreading since you want them all ran at once
    def th = Thread.start {
    Run them all and then rejoin the threads
    TestRunner.runTestStepByName(testStep.getName());
    th.join();
    }
    }
    }
    }



    I had some issues with this, mainly things like being able to view the results.
  • Hi Paul,

    Thanks for sharing the code. But when I tried to run the same , I have observed that the tests are not running actually.
    I have added some log statements to check whether thread is executing and also tried to print the response in the soapui log to verify but I have seen that the code for thread is actually not executed.

    Modified code:
    def th = Thread.start {
    Run them all and then rejoin the threads
    log.info("thread")
    TestRunner.runTestStepByName(testStep.getName());
    def soapResponse = testRunner.getTestCase().getTestStepByName("Request").getProperty("response");
    log.info(soapResponse)
    th.join();
    }
    *These two log statements are not printed in my soapui logs*

    Regards,
    Dheepha B
  • PaulDonny's avatar
    PaulDonny
    Regular Contributor
    My best guess would be a silly error that doesn't get displayed due to the threading. When I looked back over my coding I noticed something,


    Run them all and then rejoin the threads


    This line should have been a comment but it's not commented out so it is failing there.


    Now I did notice that it appears to have issues running all of the different test cases for some odd reason. Threading can be extremely complex and honestly, SoapUI does not handle it that well. For scenarios like this I would personally recommend using Java to run SoapUI project files or some external source.
  • Hi Rao,

    As per the link, i tried to execute the test cases in parallel. But it din execute any of my test.
    I don know the reason. Will that option being enabled only if we use SOAP UI Pro or by default that feature will be enabled for free ware also?

    Thanks,
    Dheepha V