REST API Automated testing approaches

rest-api-testing-approach

Did you know that it is possible to implement REST API Automated testing with JMeter? If no then this blog post might be interesting and show how powerful is JMeter. In this blog post, I would like to list pro and cons of using JMeter for automated REST API testing, so to non-technical and more general questions I will give answers. Also, I will compare different alternative approaches and tools with JMeter. Let’s start listing pros of using JMeter for automated testing:

  • Easy to write tests in JMeter
  • Free and open source
  • Maintainability of existing tests
  • Graphic interface
  • Supports non-RESTful services
  • Possibility to perform load and performance testing
  • Test recording
  • Built-in test results and reports
  • Integration with Jenkins or any CI

List of pros is pretty much impressive for software which is originally was not supposed to support functional testing. You can try to calculate how much it will cost to write framework which will cover all JMeter pros. I’m sure that you will get enough amount of budget to think about if it’s worth to write framework from scratch. Now let’s take a look at cons, which are for sure exist.

  • Test reusability
  • Extendibility
  • Integration with other testing frameworks
  • UI

Now let me aplify some of cons and the first is test reusability. With JMeter you don’t get flexibility which gives OOP, but still with “Include Controller” and “Module Controller” you can devide big tests into small parts and reuse them. But it will be tricky to pass arguments. Extendibility can be pro but I consider it as con because if you want to write some plugin you have to be familiar with JMeter API and it requires some amount of time. If you already have Selenium WebDriver tests or any automated tests it’s really hard to integrate them with JMeter. UI is at the same time is pro and con, because JMeter has specific UI and it’s not user friendly. It will take some time to get used to it.

Before making some conclusions, I would like to talk little bit about SoapUI. If you are not familiar SoapUI is actually API functional testing tool. It has open source free and commercial versions. Free version has everything you need to start testing REST API but at the end you will come up with idea that you have to buy commercial version. SoapUI is good competitor for JMeter.

Summary

If you have REST API which should not be integrated with other automated tests, i.e. when you run REST API tests independently and do not reuse them for example in Selenium WebDriver tests, then choose JMeter. If you have extra money to pay for commercial support, choose SoapUI commercial version. If you need to integrate your REST API tests with other tests then go for xUnit frameworks or RobotFramework.

Advertisements

3 thoughts on “REST API Automated testing approaches

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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