2017-05-09 73 views
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()) 
+0

BruceyBandit,你有沒有試過下面的解決方案? – Rao

回答

1

看來,你必須從context.expand

更改使用不正確的值:

${${SearchRegion}#Request} 

要:

${SearchRegion#Request} 

而且同樣適用於其他屬性好。