如何获取测试步骤编号并将其打印在脚本日志中
How to get Test Step number and print it in script logs
我正在使用 SOAPUI 5.3。我有一个包含 80 个测试步骤的测试套件。
在 testrunner 运行套件后,我想将以下内容打印到日志中。
测试步骤编号
测试步骤名称和
测试步骤状态。
我能够弄清楚如何打印测试步骤名称和状态而不是测试步骤编号。我试图获得测试步骤索引,但我无法让它工作。我是 运行 这个在测试套件级别
提前致谢。
def testSuite = context.testCase.testSuite; //get current test suite
def totalTestSteps = context.getTestCase().getTestSteps().size() //get int total test steps for the given test case
def currentTestStep = context.getCurrentStep().name //get name of current step
for(n in (0..totalTestSteps-1))
{
def testStepName = context.getTestCase().getTestStepAt(n).name
def testStepNumber = n
if (testStepName == currentTestStep){
log.info(testStepName + " is at position " + testStepNumber)
}
}
我正在使用 SOAPUI 5.3。我有一个包含 80 个测试步骤的测试套件。 在 testrunner 运行套件后,我想将以下内容打印到日志中。 测试步骤编号 测试步骤名称和 测试步骤状态。
我能够弄清楚如何打印测试步骤名称和状态而不是测试步骤编号。我试图获得测试步骤索引,但我无法让它工作。我是 运行 这个在测试套件级别
提前致谢。
def testSuite = context.testCase.testSuite; //get current test suite
def totalTestSteps = context.getTestCase().getTestSteps().size() //get int total test steps for the given test case
def currentTestStep = context.getCurrentStep().name //get name of current step
for(n in (0..totalTestSteps-1))
{
def testStepName = context.getTestCase().getTestStepAt(n).name
def testStepNumber = n
if (testStepName == currentTestStep){
log.info(testStepName + " is at position " + testStepNumber)
}
}