Hey,
ok - I tried an approach aaronpliu suggested that I'd mistaken as a lot more complicated than it appears to be
I followed all the instructions, setup the groovy - but the REST step is NOT inserting the Query parms (defined as properties) into the GET request.
The test case hierarchy is as follows:
PropertiesStep
GroovyStep1
RESTStep
GroovyStep2
The testcase and groovy executes fine - the 'setPropertyValue' just isn't adding the properties as query parms/values at all
I have a setupscript as follows:
// initialize a property "index" for loop
testCase.setPropertyValue("index", "0")
The properties step holds 2 parms and values
GroovyStep1 as follows:
//setup size of properties in order to loop run
def propsList = testRunner.testCase.testSteps["Properties"].getPropertyList()
def index = context.expand('${#TestCase#index}').toInteger()
testRunner.testCase.setPropertyValue("CountOfProps", propsList.size().toString())
// setup parameter for REST step
testRunner.testCase.testSteps["RestStep"].testRequst.setPropertyValue(propsList[index].name, propsList[index].value)
GroovyStep2 is as follows:
def index = context.expand('${#TestCase#index}').toInteger()
def max = context.expand('${#TestCase#CountOfProps}').toInteger()
if (index + 1 < max) {
// go to run step 1, here 'Groovy' name is step 1 name
testRunner.testCase.setPropertyValue("index", (++index).toString())
testRunner.gotoStepByName("GroovyStep1")
}
// note that your "REST" step will be added more parameters, if you just want to run "REST" step with one parameter, then you need to "remove" others or setup empty
In summary - test executes, groovy steps work without reporting compilation/runtime errors - but the REST URI doesnt get generated with the parameters specified in the properties file.
I thought I was onto a winner here - cos lets face it - it's someone else's groovy - can anyone point me in direction where I'm going wrong?
Oh yeah - I've attached the project file wiht a single test case of the above if anyone wants to have a look!
Again thanks to all -especially aaronpliu for supplying the groovy in first place (which I idiotically didn't notice)
richie