Forum Discussion
13 years ago
Here's a groovy script you can put at the start of your test case. It will add a json string made up of the request properties to all rest requests following it.
for(index = context.getCurrentStepIndex()+1; index < testRunner.testCase.getTestStepCount(); index++){
def request = testRunner.testCase.getTestStepAt(index).getTestRequest()
def properties = request.getProperties()
def builder = new groovy.json.JsonBuilder()
def map = [:]
for(e in properties){
if(e.value.getValue() != "") map.put(e.key, e.value.getValue())
}
builder(map)
request.setRequestContent(builder.toString())
}