【问题标题】:Iterate test steps in soapuI using groovy script使用 groovy 脚本在 soapuI 中迭代测试步骤
【发布时间】:2018-05-24 09:37:42
【问题描述】:

我目前正在尝试在 SoapUI 中为我的测试套件生成报告。

我的旧工作代码是这样的一行,在 testSuite 拆解脚本中:

def testc = project.testSuites['TestSuite'].testCases['TestCase'].testSteps['xxxxx']

但必须为每个新的测试步骤复制它。

我正在尝试使用的代码是这个:

for (service in project.testSuites) {
    for (testCase in service.testCases) {
        for (testStep in testCase.testSteps) {
            someFile.withWriterAppend{out ->out.println testStep.toString()}
        }
    }
}

Wich 给了我这个错误:

groovy?lang.MissingPropertyException:没有这样的属性:类的testCases:javaUtil.hashMap$Node

由于我使用相同的路径来访问每个测试步骤,我很惊讶无法通过迭代来完成。

【问题讨论】:

  • Benjamin,请您看看下面的解决方案,看看是否能解决上述问题?如果有帮助,您可以将其标记为answered

标签: java groovy soapui


【解决方案1】:

project.testSuites 为您提供地图。因此错误。而是使用给出列表的project.testSuiteList。所以,上面提到的错误就消失了。

同样,其他对象也是如此。请参阅下面更改的代码 sn-p。

for (suite in project.testSuiteList) {
    for (kase in suite.testCaseList) {
        for (step in kase.testStepList) {
            someFile.withWriterAppend{out ->out.println testStep.toString()}
        }
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多