我有一个Soap项目,我希望在本地以txt格式保存请求和响应,并在名称中使用测试步骤结果
def project = context.testCase.testSuite.project
project.testSuiteList.each { suite ->
suite.testCaseList.each { kase ->
kase.testStepList.each { step ->
if (step instanceof WsdlTestRequestStep) {
def reqFilePath = new File("${directoryToSave}/${suite.name}_${kase.name}_${step.name}_request${dt}.txt")
def resFilePath = new File("${directoryToSave}/${suite.name}_${kase.name}_${step.name}_response${dt}.txt")
saveToFile(reqFilePath, step.testRequest.requestContent)
saveToFile(resFilePath, step.testRequest.responseContent)
} else {
log.info "Ignoring as the step type is not Soap request"
}
目前,我正在使用这些行来保存请求和响应。
当前
File Name - SuiteName.TestCase.TestStep_response.txt
预期
File Name -SuiteName.TestCase.TestStep_response_TESTSTEPRESULT(PASS/FAIL)_Response.txt