SoapUI API Automation - Assertions

In this blog series, I will help you become an accomplished API automation engineer. Last post we created a Test Suite and Test Cases. Part 6 is the final part of this series where we create Test Assertions for your SoapUI project.

If you don’t have SoapUI you can download it here.
View all posts from the series here.

Web Hosting

Run the test

Open the Test Case window for the “Get item id 1 TestCase”. Press the green Play button. Click on the HTML tab.

You have run your test case. You can see the response has a response header and the JSON data. What you don’t have are any validations. You are not verifying that any condition is true after your test case was run. We need some assertions.

An assertion is a technical term for verifying that a condition is true. SoapUI comes with several different types of assertions. We are going to focus on the “contains” assertion for this tutorial.


Add assertions

  1. Double click the “Get item id 1” test step.
  2. At the bottom of the test step window, you will see the text “Assertions”. Click it.
  3. Click the green + button.
  4. Choose “contains” and click OK.
  5. Enter “master-ball” into the text field.

Run your test again. You will see a few things have happened. The “Assertions” tab at the bottom now has a green dot next to it. Also, the assertion that you created also has a green dot. This means the text was found and your assertion has passed.

Note: The Mac version may have some issues adding assertions. I will provide an update when I find a solution to this.

Test Assertion

Go ahead and create assertions for the other test cases that we created. Try them out. Try other types of assertions.

Congratulations! You now know the basics of using the SoapUI tool for Rest API automation. Where do you go from here? You will want to build out your project with as many Test Cases and Assertions as possible. Try out different test steps. Try out different assertions. We have only scratched the surface.



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.