【发布时间】:2015-09-11 12:07:41
【问题描述】:
提前抱歉。我确信这不是一个新问题,但我发誓我已经寻找了几天并尝试了几种解决方案,但没有一个完全符合我的需要。我希望你们能帮助我...
我的问题:
- 我有一个向我们的服务器发送 bash 命令的主脚本:
TestSuite: Tools;
TestCase: sendBashCommands;
TestStep: groovycript;
- 这个测试脚本被几个使用“运行测试用例”的测试用例调用。每个测试用例都有不同的 bash 命令:
TestSuite: ServerInfo
TestCase: getServerVersion
Property: BashCommand="cat smt | grep Version"
TestStep: Run sendBashCommands
TestCase: getServerMessage
Property: BashCommand="cat smt | grep Message"
TestStep: Run sendBashCommands
...
在我的 sendBashCommands.groovyScript 上,我已经尝试过以下操作:
//def bashCmd= context.expand( '${#BashCommand}' );
//it returns empty;
//def bashCmd= testRunner.testCase.getPropertyValue( "BashCommand" );
//it returns null;
//def bashCmd= context.getTestCase().getPropertyValue( "BashCommand" );
//it returns null;
def bashCmd = context.expand('${#TestCase#BashCommand}');
//it also returns empty;
目前我使用的解决方案适用于项目属性,但我真正需要的是在调用 sendBashCommand 脚本的测试用例级别上使用这些属性。那可能吗?我该怎么做?
【问题讨论】:
标签: groovy properties soapui getproperty getproperties