cancel
Showing results for 
Search instead for 
Did you mean: 

[Solved] How to get test case result via Groovy

Highlighted
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
Highlighted
Frequent Contributor

[SOLVED] Re: How to get test case result via Groovy

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.
Highlighted
Frequent Contributor

Re: How to get test case result via Groovy

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")
}
Highlighted
Contributor

Re: How to get test case result via Groovy

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.. 

Highlighted
Contributor

Re: How to get test case result via Groovy

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

New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Compete with community members in the TechCorner Challenge and get into the Leaderboard!

Rank Participant Points Earned
1 msiadak 12
2 nmrao 8
3 HimanshuTayal 3
Top Kudoed Authors