2017-05-09 80 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} 

而且同样适用于其他属性好。