rest - Checking HTTP status codes in groovy -
After
I created a RESTful
service and I tested it in SOAPUI HTTP
response code in the groovy
script.
I have tried to use the following: DEF value = messageExchange.responseHeaders ["# condition #"] Prior emphasis value == 200
< / Pre>
But it always returns an error and does not confirm. (The experiment I am using gives 200 status codes, but I do not know how to keep Groove correctly)
Can anyone guide me Could? I do not want to get the get
operation in groovy; I am getting the received
using different soapui and I just want to test the status code.
This will prove to be very useful for future use. I searched and found a post about it. I tested it with an HTTP step (sorry, I do not have any comfort services to use) and it works well. Fortunately, SoapUI handles all the requests in the same way, so it should work well for you as well and the raw code:.
def groovyUtils = new com.eviware.soapui .support.GroovyUtils (reference) def httpResponseHeaders = context.testCase.testSteps ["testName"] TestRequest.response.responseHeaders def httpStatus = httpResponseHeaders ["# condition #"] DEF httpStatusCode = (httpStatus = ~ "[1-5] \\ d \\ d") [0] log.info ("HTTP status code:" + HttpStatusCode)
Comments
Post a Comment