groovy - 如何在soapui中使用Groovy运行测试用例和测试套件?

标签 groovy soapui

我在soapui中有一些项目。 我想执行这些项目的测试套件和测试用例。 我尝试使用这个常规代码:

//get test case from other project or from the same one
project = testRunner.getTestCase().getTestSuite().getProject().getWorkspace().getProjectByName("Project1")
testSuite = project.getTestSuiteByName("TestSuite 1 - Login");
testCase = testSuite.getTestCaseByName("TestCase 1-Login");
Thread.sleep(3000)
testSuite2 = project.getTestSuiteByName("TestSuite3 - Report");
testCase2 = testSuite.getTestCaseByName("TestCase1 - Report");

// run test case
runner = testCase.run(new com.eviware.soapui.support.types.StringToObjectMap(), false);
Thread.sleep(3000)
runner2 = testCase2.run(new com.eviware.soapui.support.types.StringToObjectMap(), false);

当我运行这个常规代码时,出现以下错误消息: java.lang.NullPointer.Exception 无法在最后一行的 null 对象上调用 run() 方法

runner2 = testCase2.run(new com.eviware.soapui.support.types.StringToObjectMap(), false);

如果我删除最后一行,它就可以正常工作。

请帮忙。 谢谢

最佳答案

我知道现在回答这个问题已经太晚了,但我会回答这个问题,以便它可以帮助寻求帮助。

不用 Thread.sleep(3000),只需使用:

runner.waitUntilFinished()

现在它将等待直到步骤 1 执行完成。然后就会开始执行步骤2。

关于groovy - 如何在soapui中使用Groovy运行测试用例和测试套件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28596966/

相关文章:

java - 如何从命令行调用带有 'java' 的 groovy

java - Groovy 可以复制类签名但修改实现吗

java - 我们可以 Runtime.getRuntime().exec ("groovy");

xml - 使用 groovy 在 SoapUI 中解析 XML 响应

groovy - SOAPUI 使用 groovy 从文件加载自定义属性

java - SoapUI项目执行后WebDriver异常

rest - 如何在休息时在 SOAPUI 中发布值

jenkins - 如何在Jenkins文件Groovy函数的阶段外访问变量?

java - 获取没有 '~' 字符的路径

xpath - 如何在soapui的命名空间中声明通配符?