//获取保存response的文件路径和名称
def testSuiteName = context.testCase.testSuite.name
def testCaseName = context.testCase.name
def fileName = context.expand( '${projectDir}' )+"/TestData/"+testSuiteName+"/"+ testCaseName+"/"+context.expand('${DataSource#testData}')+".txt"
def myResponse = "" def ifSaveResponseAsExpected = context.expand('${#testsuite#ifSaveResponseAsExpected}')
if(ifSaveResponseAsExpected=="yes"){
//获取response保存到本地
myResponse = messageExchange.response.contentAsString
File file = new File(fileName)
file.write(myResponse)
}