Assertions, Automation, Automation Framework, SoapUI, Testing, Web Testing

SoapUI Tutorial Part 3 : Deep dive assertions in SoapUI

Validation is way too important than Invention, I hope you agree with this statement as not only testers , business analysts ,product owner believe in this statement but developers , customers are also getting inclined with the same thought . The idea is to show case the importance of change in perception of a developer with a QA.

In this write-up I will share how can we add verification’s in our SoapUI tests.

Why assertions are required , At All ?
Rarely , it is seen that the one who is making any stuff has similar thinking with the one whose job is to find issues in that particular piece of work done. And this is al-right and very normal. Similarly, to get a job done right we need to make some validations over the tests which we used to write to test SUT(System Under Test).
Assertions are used to put some checks over tests ,for which we know the result prior to the run. They are used to check the relevant points such that we can take care of all positive and negative scenarios in one go.

Positive Assertions
These are the happy tests assertions like for any web service a response should be HTTP response 200 OK, so we can test for the string ‘200 OK’. And is positive assertion.

Negative Assertions
For the same example above, we know that same service in same module should not contain HTTP response 404 , or 400. So in these scenarios we can apply Not Contains kind of assertions.

How to add assertions in SoapUI?
Well, thats fine , but the point is to apply these assertions in SoapUI. SoapUi provides very cool steps to apply assertions in Test Requests and Test cases.
So in SoapUi you can add assertions in multiple ways:
1. You can add assertion as a separate test step in test case.
* Just right-click on test case and click on ‘Insert Step‘.
* You will get an option of  ‘Assertion TestStep‘, select this option for creating a new assertion as a new test step.
2. You can add assertions in a test step.
* Click on a test step. On the editor view , in the button select the highlighted icon.
* You will get a pop-up which allows you to add new assertion by clicking on ‘Add Assertion’ within the test step selected.


What all types of assertions are there in SoapUI ?

SoapUI offers various types of assertions, you can get various assertion when you click on Add Assertion icon. Highlighted assertions are the one’s which you can use in test steps like SOAP , REST , MOCK ,etc.


And the one’s which are not highlighted and enabled can only be used in DB related steps like JDBC


To add them in your tests, you need to click on the type of assertion you want to add. And you are DONE!

Lets try adding an assertion in a test step:


Project Name : geoipservice

Interfaces provided : GeoIPServices.

Lets make a new Test Suite first, by right clicking on project.

Make a new Test case ,by right clicking on test suite.

Now, add a Test Request of  SOAP type. And once done, double click on the test step,so that we can see the request just made in editor view.

Next, click on the assertion tab present below the test request area( highlighted in above image ).

Select an option from the list for example ,

  • Property Transfer : It provides various types of assertions which are for text match like contains , not contains , xpath match etc.
  • Compliance, status , standards: These are more into HTTP codes , responses , So if you want to validate status codes you can use these assertions.
  • Script: These are the widely used assertions where-in you can add your custom assertions in groovy.
  • SLA:  It checks the time ,responsiveness of responses coming from requests.
  • JMS: These are basically used to check the response of Java Messages Services(JMS) ,their status ,etc.

And thats all , we are done . You see this is that much simple. I enjoyed using SoapUi for adding assertions in test cases, you can also try the same and we can talk over any query or issue you will encounter while execution.

Till then ,stay tuned.


1 thought on “SoapUI Tutorial Part 3 : Deep dive assertions in SoapUI”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s