如果是xml就用这个
// to read a node from your Response def grUtils = new com.eviware.soapui.support.GroovyUtils(context) // depending on when / how your are doing this, you will need to provide the exact test step name def xmlHolder = grUtils.getXmlHolder("${context.currentStep.name}#Response") def seatIdNode = xmlHolder.getDomNode("//*:singleSeat[availableForSelection='true']/seatId")
如果是json,那么用这个:
import groovy.json.JsonSlurper
//将response作为一个String def xresponse = testRunner.testCase.testSteps["getStepOne"].testRequest.response.contentAsString def slurper = new JsonSlurper()
//将这个response的String Parse成为Json def re = slurper.parseText(xresponse) def num=re.calendar.size() def i = testRunner.testCase.testSteps["DataSource"].currentRow
//依次遍历ID if(i<num) { result["cal_id"]=String.valueOf(re.calendar_id.id[i]) }