Ask a Question

[Solved] How to get test case result via Groovy

Buschfunk
Frequent Contributor

[Solved] How to get test case result via Groovy

Hello,

How can I get the result of a test case using Groovy, i.e. just a simple "PASSED" or "FAILED"? I've found this link (http://www.soapui.org/Scripting-Propert ... ng-results) but it logs all test step results.

Sincerely,
Robert
4 REPLIES 4
Buschfunk
Frequent Contributor

I've found the following code line which gives me the status of the test case.

def result = testRunner.getStatus()

However the following does not work:


def result = testRunner.getStatus()
if (result == "FINISHED") {
log.info("Test passed")
} else {
log.info("Test not passed")
}

Nothing is written to the script log.
Buschfunk
Frequent Contributor

Found the solution:

def result = testRunner.getStatus()
if (result == com.eviware.soapui.model.testsuite.TestRunner.Status.valueOf("FINISHED")) {
log.info("Test passed")
} else {
log.info("Test not passed")
}


or

def result = testRunner.getStatus().toString()
if (result == "FINISHED") {
log.info("Test passed")
} else {
log.info("Test not passed")
}

I am sorry, but this gives me always "RUNNING" when I try to execute test..

 

So there is really no way.. how to in side TC get status? 

Thanks a lot.. I am lost after few hours to found solution.. 

This works only in tear donw script.. but not in groovy test step.. In groovy test step you will get only "RUNNING"..

cancel
Showing results for 
Search instead for 
Did you mean: