Forum Discussion

KrishnaReddy_YV's avatar
KrishnaReddy_YV
New Contributor
16 years ago

Need to run the test cases for multiple times.

Hi Ole,
  I'm getting Socket exception while invoking the java based web services and aslo while executing the test cases thorugh SOAP UI. The exact exception I'm getting is "Error getting response; java.net.SocketException: Software caused connection abort: recv failed" and giving the blank response. But if I tried by invoking the same service for multiple times, let say 3 or 4 times I'm able to get the response. So becase of this exception all of my automated test cases are failing. But as per requirement I need to pass the test cases for the for the first attempt, since automated test cases are not running multiple times to get response.
  So finally I tried to write a groovy script which intends to run the test scripts for 5 times untill it get response. But the problem in my code is that it is not able to run the test cases for multiple times.
  So, could you please give me the hint that where I can modify the below code to run the test case for multiple times until I get the response.
  The code I tried to execute is as folows -

def openrequest = testRunner.testCase.getTestStepByName( "getCasesBySubject - Request Transformation Failure -101" );
def property = openrequest.getProperty( "response" );
def count = 0;
while(count <10 && property.value == null){
testRunner.gotoStepByName( "getCasesBySubject - Request Transformation Failure -101" );
count ++;
}

Many Thanks,
Krish

5 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi,

    The problem is the testRunner.gotoTestStepByName method which does not actually execute that TestStep but transfer control to it once the current script finishes.. either you should use the

    testRunner.runTestStep( testRunner.testCase.testSteps["getCasesBySubject - Request Transformation Failure -101"], true, true )


    method (new in 2.5), or maintain a counter in the context for keeping track of the number of loops.. ie create a script after the request containing

    if( context.counter == null )
      context.counter = (int) 5

    if( context.counter > 0 )
    {
        context.counter--
        testRunner.gotoStepByName( "getCasesBySubject - Request Transformation Failure -101" )
    }


    Here the script first checks for a counter and initializes it if missing, the counts down a loops back to the request for 5 times..

    Hope this helps!

    regards,

    /Ole
    eviware.com
  • Hi Ole,
            Thanks for the prompt reply. As you suggested I have installed the Soap UI 2.5 version and executed code as below -

    def openrequest = testRunner.testCase.getTestStepByName( "getCasesBySubject - Request Transformation Failure -101" );
    def property = openrequest.getProperty( "response" );
    def count = 0;
    while(count <10 && property.value == null){
    testRunner.runTestStep( testRunner.testCase.testSteps["getCasesBySubject - Request Transformation Failure -101"], true, true )
    count ++;
    }

    But I got an exception as below mentioned -

    groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.panels.support.MockTestRunner.runTestStep() is applicable for argument types: (com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep, java.lang.Boolean, java.lang.Boolean) values: {com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep@453dd5, true, true}

    For you reference here I'm attaching the structure of the TestSuit.



    what could be going wrong here..

    thanks
    krish
  • Hey Ole,

    I don't understand what is wrong here.
    i installed your nightly build version and still getting the same error. attaching screen shot for your reference.



    pl let me know what more info i can provide to debug this error.
    thanks
    Krish.

    ps: we can get in touch over phone if its ok with you. Need to get this working ASAP. you can email your contact no to me on: manmaygupta[at]gmail.com
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    please try using

    testRunner.runTestStepByName( "getCasesBySubject - Request Transformation Failure -101"] )

    instead, let me know!

    /Ole
    eviware.com