我有一个groovy脚本调用webservice.I想要检查webservice调用是否成功运行使用Junit测试用例的groovy脚本。请帮忙
答案 0 :(得分:-1)
您需要在测试代码中嵌入Groovy解释器:
// call groovy expressions from Java code
Binding binding = new Binding();
binding.setVariable("foo", new Integer(2));
GroovyShell shell = new GroovyShell(binding);
Object value = shell.evaluate("println 'Hello World!'; x = 123; return foo * 10");
assert value.equals(new Integer(20));
assert binding.getVariable("x").equals(new Integer(123));
有关详细信息,请参阅documentation how to embed Groovy