jkrier
7 years agoRegular Contributor
Running SoapUI specific methods from an external script
I have an external groovy script that evaluates a response ( "yes" or "no" ). If the response is "no" I want the testRunner to fail. This is the code I have in my code library
package library.serviceAvailabilityResult
import org.apache.commons.lang.RandomStringUtils
class ServiceAvailabilityResult {
String getServiceAvailabilityResult(String result) {
String serviceAvailabilityResult
if (result == "yes") {
serviceAvailabilityResult = result
} else if (result == "no") {
return testRunner.fail('SERVICE IS NOT AVAILABLE')
}
}
}
This obviously fails. Does anyone know how to return the
testRunner.fail('SERVICE IS NOT AVAILABLE')
in a way that SoapUI sees it as a command?
I am calling the method above in a groovy script that looks like this
def myServiceAvailabilityResult = new ServiceAvailabilityResult() String result = "no" String myResult = myServiceAvailabilityResult.getServiceAvailabilityResult(result) log.info myResult