groovy - SoapUI 开源项目测试用例无限循环运行
问题描述
我有一个带有测试套件设置脚本的 SoapUI 项目,它基于全局属性多次运行测试用例,但它在无限循环中运行。请帮我解决问题:
def project = null
def workspace = runner.testSuite.project.getWorkspace();
def count=context.expand('${#Global#run}')
if (workspace != null) {
project = workspace.getProjectByName("IQCX")
}
if (project.open && project.name == "IQCX") {
def properties = new com.eviware.soapui.support.types.StringToObjectMap()
def testcase = project.getTestSuiteByName("TestSuite 1").getTestCaseByName("Login");
def testcase1 = project.getTestSuiteByName("TestSuite 1").getTestCaseByName("Logout");
if(testcase == null)
{
throw new RuntimeException("Could not locate testcase 'TestCase'! ");
} else {
// This will run everything in the selected project
for(int i=1;i<=count;i++){
if(i!=count){
testcase.run(new com.eviware.soapui.support.types.StringToObjectMap(), false)
sleep(70000)
testcase1.run(new com.eviware.soapui.support.types.StringToObjectMap(), false)
sleep(5000)
log.info( "Finished running "+i+" cycle" )
}
else if(i==count){
log.info "count is " + i
runner.cancel("finish it")
testcase=null
return null
break;
}
else{
break;
}
}
runner.cancel("finish it")
testcase=null
return null
}
}
else {
throw new RuntimeException("Could not find project")
}
解决方案
这是通过将 def count 转换为 Integer 来解决的。不管怎么说,还是要谢谢你
推荐阅读
- javascript - 唯一数组Javascript中具有不同键的数组列表
- python - 处理 pandas Dataframe 中的 no-List
- java - 如何使用 Retrofit 从 OpenWeatherMap API 获取“天气”对象数据
- c# - 使用 DLLImport 从 C# 调用 c++,找不到对象引用错误
- javascript - 无法理解错误:TypeError:无法读取未定义的属性“订阅”
- python - 在python中计算GPS点之间的测地线距离
- c - 标记 doxygen 注释并将它们放在单独的文件中/从源/注释块构建文档
- sql - Case 语句在预期时未返回 null
- c++ - 类外的静态 const 成员初始化
- javascript - 使用变量设置标签中的属性值