Forum Discussion

philyoung99's avatar
philyoung99
Occasional Contributor
8 years ago

groovy loop help

This is probably something easy. I have just picked up SOAP UI open source and tried the loop on the Smartbear site

 

steps 

1. SOAP Request

2. Loop

 

if( context.loopIndex == null )
context.loopIndex = 0

if( ++context.loopIndex < 3 )
testRunner.gotoStepByName( "SOAP Request" )

 

The above works

 

However, the moment I try to add any line of code such as "log.info(context.loopIndex)" as below, I seem to have an infinite loop? 

 

if( context.loopIndex == null )
context.loopIndex = 0

if( ++context.loopIndex < 3 )
log.info(context.loopIndex)
testRunner.gotoStepByName( "SOAP Request" )

 

What is happening here?

 

 

Ideally I would like to use a line such as 
//testRunner.testCase.setPropertyValue("FromCurrency", "GBP" )//why infinite loop with this step added?

 

And then ultimately use a variable in place of the "GBP" value for each SOAP Request

 

thanks in advance.

phil