我無法從SOAP UI中的測試套件拆卸級別的測試步驟中獲取斷言結果。我看着Javadoc並嘗試使用getAssertionList()
,但調用它會導致錯誤。這裏是我的Groovy腳本至今:如何從SOAP UI TestSuite Teardown Script獲取測試運行斷言結果(狀態和名稱)?
def failedTestCases = 0
def successTestCases = 0
def failedTestSteps = 0
def successTestSteps = 0
runner.results.each { testCaseResult ->
def caseName = testCaseResult.testCase.name
def caseStatus = testCaseResult.status.toString()
if(caseStatus == 'FAILED'){failedTestCases ++}
else {successTestCases ++}
log.info "Test Case: $caseName $caseStatus"
testCaseResult.results.each{ testStepResults ->
testStepResults.messages.each() { msg -> log.info msg }
def stepName = testStepResults.testStep.name
def stepStatus = testStepResults.status.toString()
if(stepStatus == 'FAILED'){failedTestSteps ++}
else{successTestSteps ++}
log.info "Test Step: $stepName $stepStatus"
def testStep = testStepResults.testStep
log.info "XX" + testStep.name
testStep.getAssertionList().each{
log.info "$it.label - $it.status"
}
}
}
log.info "Total test cases:" + (successTestCases + failedTestCases).toString()
log.info "Total succeeded: $successTestCases"
log.info "Total failed: $failedTestCases"
log.info "Total test step count:" + (successTestSteps + failedTestSteps).toString()
log.info "Total succeeded: $successTestSteps"
log.info "Total failed: $failedTestSteps"
我能看到XX [TestStepName],但無論從日誌條目斷言或結果,但我得到這個錯誤:
週五10年11月6日: 13:36 EST 2015:錯誤:發生錯誤[沒有方法的簽名:com.eviware.soapui.impl.wsdl.teststeps.WsdlPropertiesTestStep.getAssertionList()適用於參數類型:()values:[]],請參閱錯誤日誌以獲取詳細信息