2016-08-31 51 views
1

我在我需要打印使用打印在常规脚本步骤的请求步骤响应变量

  • SOAP请求测试步骤的名称被许可在Groovy Script测试步骤XML响应的要求

当我写

log.info context.expand('${Licensed#Response}') 

我马上响应

但是我有一个要求,其中用户不知道该代码

def requestname=Licensed //user will enter request name here 

log.info context.expand($'{requestname"#Response}') 

的我没有得到有效的响应

我要声明一个变量,使用和打印XML响应

+0

log.info上下文。 ($'{requestname'+#Response“}') –

+0

此外,我试图def requestfull = Licensed#响应log.info context.expand($'{requestfull}),这也不起作用 –

+0

早些时候正确的响应代码是日志。 info context.expand('$ {Licensed#response}') –

回答

0

这里是你需要使用步骤名称作为参数/变量。你的代码片段中有一个微不足道的错误。

//You missed quotes 
def requestname='Licensed' 
//Your were using quotes incorrectly 
log.info context.expand('${'+requestname+'#Response}') 

希望这可以解决您的问题。

+0

非常感谢你的工作 –

+0

@GauriAparadh,很高兴知道答案是有帮助的。我将不胜感激,如果你花一点时间[接受它作为答案](http://stackoverflow.com/help/someone-answers) – Rao