Groovy 在SoapUI中传递类中的testRunner对象
我试图在SOAPUIGroovy脚本测试步骤中执行下面的groovy代码。我是groovy新手,不确定这是否是在类中传递对象的正确方法。如果我不将代码放入Groovy 在SoapUI中传递类中的testRunner对象,groovy,soapui,Groovy,Soapui,我试图在SOAPUIGroovy脚本测试步骤中执行下面的groovy代码。我是groovy新手,不确定这是否是在类中传递对象的正确方法。如果我不将代码放入RunTestSteps类和runSteps方法中,它就可以正常工作。 下面,我试图在RunTestSteps类中传递testRunner对象。默认情况下,Groovy脚本测试步骤是通过testRunner对象调用的 class RunTestSteps{ def testRunner; RunTestSteps(testRunne
RunTestSteps
类和runSteps
方法中,它就可以正常工作。
下面,我试图在RunTestSteps
类中传递testRunner
对象。默认情况下,Groovy脚本测试步骤是通过testRunner
对象调用的
class RunTestSteps{
def testRunner;
RunTestSteps(testRunner)
{
this.testRunner=testRunner;
}
def runSteps = {
def TC= testRunner.testCase
def TestStepCollection= testRunner.testCase.getChildren()
//log.info(TestSptepCollection.size())
for (int i = 1; i < TestStepCollection.size() ; i++)
{
do something ..
}
else {
do something else
}
}
}
}
def run = new RunTestSteps().runSteps
run()
感谢您的帮助。谢谢。在Groovy脚本中,规则是:
def testStepCollection = testRunner.testCase.getChildren()
testStepCollection.each {
// do something, refering to each item as 'it'
}
谢谢,我把
def run=new RunTestSteps().runSteps;在groovy脚本测试步骤中运行()
,将该类放入diff文件中,并让soapUI从首选项中读取该类文件。代码现在正在运行。
def testStepCollection = testRunner.testCase.getChildren()
testStepCollection.each {
// do something, refering to each item as 'it'
}