vendredi 6 novembre 2015

How to get the test run assertion result (status and name) from a SOAP UI TestSuite Teardown Script?

I am having trouble getting the assertion results from the the test steps at the testsuite teardown level in SOAP UI. I looked at the Javadoc and attempted to use getAssertionList() but calling that is causing an error. Here's my Groovy script so far:

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"

I'm able to see XX[TestStepName] but no assertion or results from the log entry, but I am getting this error:

Fri Nov 06 10:13:36 EST 2015:ERROR:An error occurred [No signature of method: com.eviware.soapui.impl.wsdl.teststeps.WsdlPropertiesTestStep.getAssertionList() is applicable for argument types: () values: []], see error log for details

Aucun commentaire:

Enregistrer un commentaire