0
我生成一個文件只有一種形式,它應該輸出2個的各種請求,並從它們是不同的SOAP請求的步驟2箇中的各種對策:文件顯示的請求和響應
TestRegion
TestRules
但是我注意到文件僅僅是生成TestRegion
請求和響應每次超過2次。對於每個請求,它顯示TestRegion
請求,對於每個響應,它顯示TestRegion
響應。爲什麼它這樣做,我怎樣才能得到正確的請求和響應顯示?它會顯示硬編碼的字符串,如TESTREGION REQUEST:
,然後在TEST REGION RESPONSE
之後,但請求和響應不正確。
def testRegionRequest = context.expand('${${TestRegion}#Request}' )
def testRegionResponse = context.expand('${${TestRegion}#Response}' )
def testRulesRequest = context.expand('${${TestRules}#Request}' )
def testRulesResponse = context.expand('${${TestRules}#Response}' )
def fileName = "XXX.txt"
def logFile = new File(fileName)
//Draws a line
def drawLine(def letter = '=', def count = 70) { letter.multiply(count)}
def testResult = new StringBuffer()
testResult.append drawLine('-', 60) + "\n\n"
testResult.append "\n\nTEST REGION REQUEST:\n\n"
testResult.append(testRegionRequest.toString())
testResult.append "\n\n" + drawLine('-', 60) + "\n\n"
testResult.append "\n\nTEST REGION RESPONSE:\n\n"
testResult.append(testRegionResponse.toString())
testResult.append "\n\n" + drawLine('-', 60) + "\n\n"
testResult.append "\n\nTEST RULES REQUEST:\n\n"
testResult.append(testRulesRequest.toString())
testResult.append "\n\n" + drawLine('-', 60) + "\n\n"
testResult.append "\n\nTEST RULES RESPONSE:\n\n"
testResult.append(testRulesResponse.toString())
// Now create and record the result file
logFile.write(testResult.toString())
BruceyBandit,你有沒有試過下面的解決方案? – Rao