ProductivityAndFun Download Trial - Free 14 day evaluation

10 Tips for the soapUI Beginner - Tip 4) To assert or not to assert: that should never be a question

PDF Print E-mail
User Rating:  / 50
Rate this article: PoorBest 

Tip 4) To assert or not to assert: that should never be a question

Testing in soapUI is all about the assertions. Without them you can’t properly say that you have performed a test. This begs the question: so, what is an assertion then? Simply put, assertions are checks that what you receive is what you expected to. An example; I have a Web Service where I search for a product by product id. In the response i expect the same product id in the field named product id. If I do manual testing, I send the request and then look for the matching id in the response.  This is what we call asserting. As you can see assertion is an integral part of testing, yet quite a fair share of testing in testware is done without assertions, and we'd like you to get into the habit of performing them in soapUI. An example of an assertion would be to say, “If the response contains the company name eviware, the service I’m testing seems to work”.

Creating assertions is real simple in soapUI; you create them by going to the Assertion Tab assertion-tab-soapUIin the soapUI request/response editor.

 

Creatin an new assertion in soapUI when doing a functional testIn the editor you click the button for New Assertion and then choose which type of assertion you would like. At first you can start off with a very simple assertion like the Contains assertion, which checks the entire response for a text, and then quickly moves to the more accurate XPath assertion (look at soapUI Pro, the XPath assertions are real simple there), where you check for a text in a certain element in the response. The Contains assertions says "I want the text 'eviware' to be in the response", while XPath says "I want the text 'eviware' to be in the Company Name element response".

 

So now, go ahead and create an assertion:

 

Contains Assertion example for SOA Testing

See how easy it is? Don't stop there; try the other assertions as well and figure out how they work.

Now it's time to move to the next level of soapUI. A question we often get from new users are; "How do I take something in the response and use it in the next Request", or in soapUI-speak, "How to I transfer the contents of an element in a response and put it in an element in a request?". It will all be revealed in the next tip; Tip 5) Learn how to Transfer Properties

 


Go to Article Page: Go to Previous Page 1 2 3 4 5 6 7 8 9 10 11 Go to Next Page