Forum Discussion

jsreesoap's avatar
jsreesoap
Contributor
11 years ago

[Rs]Executing test case in iterations by incrementing values

Hi
I am trying to run a test case in iterations- Here is my requirement.
In each iteration the appended number to a string should get incremented like 'offername1' in first iteration and 'offername2' in second iteration and so on. I tried

import com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus

for(i in 0..8 )
{
def incrementValue = context.expand( '${#TestCase#incrementValue}' )
log.info "incrementValue derived" + incrementValue
incrementValue = incrementValue.toInteger()+1
testRunner.testCase.testSuite.setPropertyValue("offerName","offername"+incrementValue)
testRunner.testCase.testSuite.setPropertyValue("ticker","ti"+incrementValue)
testRunner.testCase.setPropertyValue("incrementValue",incrementValue+"")
testRunner.gotoStepByName( "ClosingDate groovy")

testRunner.runTestStepByName( "ClosingDate groovy")

if (i==4){break}
log.info i
}
but it wouldn't stop when I value is 4. I am doing something wrong. Attached screen shot shows the test case structure.
Pls let me knwo how I can achieve this.
Thanks
  • Thanks Temil. I opened a ticket but forgot to attach the project so I emailed to the ticket created email.
    Here it is the case number Case #00034108. I would like to achieve the result with or without groovy script. If I could use built it functions like in HP Service Test, that will be great.
  • I found a simple way. Not sure how I missed it. I am using 'data generator' to generate random numbers. I capture them and use in my script like below:

    def randomValue = context.expand( '${DataGen#RandomValue}' )
    log.info "randomValue= " +randomValue
    testRunner.testCase.testSuite.setPropertyValue("offerName", "PrivateOfferType-" + randomValue)