Forum Discussion
Kevin_Slade
17 years agoContributor
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
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
- newrej7 years agoNew 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
Related Content
- 2 years ago
- 2 years ago
Recent Discussions
- 18 hours ago
- 17 days ago