SoapUI TestSuite的拆解脚本的结果与运行TestCases的顺序不同。如何解决?

时间:2019-06-05 12:56:03

标签: javascript soapui teardown

我正在最后创建一个带有Teardown脚本的TestSuite,该脚本从每个TestCase收集数据。脚本正在运行,但问题是-结果与测试用例的执行顺序不同。如何解决?我需要的结果与测试用例的顺序完全相同。

    //log test suite name
def testSuiteName = runner.getTestSuite().getName()
log.info(' Test Suite: ' + testSuiteName)
//log test suite properties
for(TestSuiteProperty in runner.getTestSuite().getPropertyList()){
log.info(' Test Suite property: ' + TestSuiteProperty.getName() + ' = ' + TestSuiteProperty.getValue())
}
for(testCaseResult in runner.results){
def testCaseName = testCaseResult.getTestCase().getName()
log.info(' Test Case ' + testCaseName + ' Starting...')
//check for test cases in error
if(testCaseResult.getStatus().toString() == 'FAILED' ){
//log test case in error
log.error(' Test Case ' + testCaseName + ' has failed !')
//log error message
for( testStepResult in testCaseResult.getResults() ){
testStepResult.messages.each()
{ msg -> log.error msg } 
}
}else{
//if not null display properties
for(ResultsProperty in testCaseResult.getTestCase().getTestStepByName("Results").getPropertyList()){ 
if(ResultsProperty.getValue() != null)
{ log.info( ' Test Step Result: ' + ResultsProperty.getName() + ' = ' + ResultsProperty.getValue()) } 
}
//if not null display errors
for(ErrorsProperty in testCaseResult.getTestCase().getTestStepByName("Errors").getPropertyList()){ 
if(ErrorsProperty.getValue() != null)
{ log.error( ' Test Step Error: ' + ErrorsProperty.getName() + ' = ' + ErrorsProperty.getValue()) } 
}
//log OK if no errors in test case
log.info(' Test Case ' + testCaseName + ' finished successfully!')
}
}  

0 个答案:

没有答案