0

I'm using SoapUI Pro, datasouce step from type groovy.

first part of my script:

def url = "http://www.xmlfiles.com/examples/plant_catalog.xml"
def slurper  = new XmlSlurper()
def content = slurper.parseText(url.toURL().text)
def allPlants = content.PLANT

second part of my script:

def row = testRunner.testCase.testSteps["groovyDS"].currentRow

if (row < allPlants.size()){
    result["zone"]=content.PLANT[row].ZONE
    result["light"]=content.PLANT[row].LIGHT
    result["price"]=content.PLANT[row].PRICE

}

Currently all script run from the beginning every row. I want the first part to run only once, and the second for each row

1 Answer 1

0

You could warp the first part of your script in

if(testRunner.testCase.testSteps["groovyDS"].currentRow == 1) {
    // your script
}

However, this will not accomplish what you intend. On your second pass, allPlants.size() will error with a null poiter exception.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.