[SoapUI] 在SoapUI中,设置开关批量保存整个Response,作为期望结果进行校验

//获取保存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)
}

  

posted on 2019-03-19 13:26  张缤分  阅读(252)  评论(0编辑  收藏  举报

导航