Ask a Question

Create a assertion "Valid HTTP Status Codes" via Groovy scri

vmphuongvhp
Not applicable

Create a assertion "Valid HTTP Status Codes" via Groovy scri

Hi all,
I want to create a assertion "Valid HTTP Status Codes" via Groovy script. I have researched this in Google but not saw. I can create a assertion "XPath" or "Xquery" but with assertion "Valid HTTP Status Codes" I can't. Please help.
2 REPLIES 2
nmrao
Community Hero

Check if this helps
http://www.soapui.org/Functional-Testin ... tions.html
http://www.soapui.org/Scripting-Propert ... ricks.html

Still have quries, reply with more details.


Regards,
Rao.
KarelHusa
Super Contributor

The way to create Valid HTTP Status Codes assertion is similar to other types. You create a WsdlTestRequestStep as usual.

 

Then you add the assertion:

 

ValidHttpStatusCodesAssertion vhsa = step.addAssertion('Valid HTTP Status Codes')

 

Finally you need to configure the list of valid codes, and here it comes a bit tricky:

 

vhsa.setConfiguration(org.apache.xmlbeans.XmlObject.Factory.parse('<codes>200,202</codes>'))

I have not found a nicer way, but it works.

 

Karel@apimate.eu
https://apimate.eu
cancel
Showing results for 
Search instead for 
Did you mean: