Forum Discussion
SmartBear_Suppo
Alumni
16 years agoHi Nic,
At the moment, soapUI does not have a feature allowing elegant way to access HTTP status, let alone HTTP status code.
Fortunately, Groovy and some hacking are your friends here.
Here's one way to retrieve HTTP status code:
After this you can access this property using property expansion.
Does this hack fill your need?
Cheers!
/Nenad Nikolic a.k.a. Shonzilla
At the moment, soapUI does not have a feature allowing elegant way to access HTTP status, let alone HTTP status code.
Fortunately, Groovy and some hacking are your friends here.

Here's one way to retrieve HTTP status code:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def httpResponseHeaders = context.testCase.testSteps["Google Search request"].testRequest.response.responseHeaders
def httpStatus = httpResponseHeaders["#status#"]
def httpStatusCode = (httpStatus =~ "[1-5]\\d\\d")[0]
log.info("HTTP status code: " + httpStatusCode)
groovyUtils.setPropertyValue("Properties", "httpStatusCode", httpStatusCode)
After this you can access this property using property expansion.
Does this hack fill your need?

Cheers!
/Nenad Nikolic a.k.a. Shonzilla