Forum Discussion

Kevin_Slade's avatar
Kevin_Slade
Contributor
17 years ago

SoapUI Pro 2.0.2 gotoStepByName is apparently not executed

The code fragment below is executing both log.info statements.

The loop count is incremented in the SaveTime1 step. The loop_cnt has a value of 1 as shown by the Groovy log. What am I dooing wrong. I am using SoapUI 2.0.2 Pro


if ( ( loop_cnt < 101 ) ) {
    log.info( "gotoStepByName( SaveTime1 )");
    testRunner.gotoStepByName( "SaveTime1")
    log.info( "gotoStepbyName failed");
} else {
    log.info( "loop_cnt terminated = [" + loop_cnt + "]" );
}
log.info( "fell through to here");


Groovy log

Fri Mar 07 12:12:08 NZDT 2008:INFO:loopCnt = [1]
Fri Mar 07 12:12:08 NZDT 2008:INFO:loop_cnt = [1]
Fri Mar 07 12:12:08 NZDT 2008:INFO:gotoStepByName( SaveTime1 )
Fri Mar 07 12:12:08 NZDT 2008:INFO:gotoStepbyName failed
Fri Mar 07 12:12:08 NZDT 2008:INFO:fell through to here
Fri Mar 07 12:12:08 NZDT 2008:INFO:repeatCnt = [1]

4 Replies

  • After looking through  the forums I found a comment about inserting a return.

    The following code fragment does work as desired.

    if ( ( loop_cnt < 101 ) ) {
        log.info( "gotoStepByName( SaveTime1 )");
        testRunner.gotoStepByName( "SaveTime1")
        log.info( "gotoStepbyName failed");
        return
    } else {
        log.info( "loop_cnt terminated = [" + loop_cnt + "]" );
    }
    log.info( "fell through to here");


    The results from the Groovy Log are:

    Fri Mar 07 12:12:08 NZDT 2008:INFO:repeatCnt = [1]
    Fri Mar 07 12:27:33 NZDT 2008:INFO:loopCnt = [1]
    Fri Mar 07 12:27:33 NZDT 2008:INFO:loop_cnt = [1]
    Fri Mar 07 12:27:33 NZDT 2008:INFO:gotoStepByName( SaveTime1 )
    Fri Mar 07 12:27:33 NZDT 2008:INFO:gotoStepbyName failed
    Fri Mar 07 12:27:33 NZDT 2008:INFO:loopCnt = [2]
    Fri Mar 07 12:27:33 NZDT 2008:INFO:loop_cnt = [2]
    Fri Mar 07 12:27:33 NZDT 2008:INFO:gotoStepByName( SaveTime1 )
    Fri Mar 07 12:27:33 NZDT 2008:INFO:gotoStepbyName failed
    Fri Mar 07 12:27:33 NZDT 2008:INFO:loopCnt = [3]

    Sorry for the noise but I hope this helps someone else
    • newrej's avatar
      newrej
      New Contributor

      I am facing similar issue in Load UI of ready API.

      Issue does not happen when the test case is run in Soap UI test runner.

      When run in Load UI, Load UI runs the same data twice - once with "Tax- Request 1" and another one with "Tax- Request 2".

       

      It seems like the "Conditional Goto" is being bypassed when running in Load UI of Ready API.


       

       

      import static com.jayway.jsonpath.JsonPath.parse
      
      def hub = context.expand( '${OD Cxr List#Hub}' )
      log.info "hub=" + hub
      if (hub == "") 
      {testRunner.gotoStepByName("Tax- Request 2")
      log.info "hub was null"
      }
      else {testRunner.gotoStepByName("Tax- Request 1")
      log.info "hub had value"
      
      }

       

      Any feedback is appreciated.

       

      Thanks,

      Neerej

       

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Kevin,

    I really have to agree the gotoStepByName method is confusing; what it does is tell the testrunner which step to go to when the current Script has finished/returned.

    We plan to eventually add a testRunner.runTestStepByName( ... ) method that runs the specified step directly.

    Sorry for the confusion.

    regards!

    /Ole
    eviware.com
  • Thanks Ole.

    I just hope this saves someone else lots of wasted time.

    Glad you are so responsive

    Regards Kevin