How to Choose an API Testing Tool
Focusing only on UI automation can kill your test automation efforts. There is a host of reasons why the main one being that UI tests are notoriously slow.
More and more companies today are making the shift-left towards DevOps continuous integration and continuous deployment development. That means our feedback needs to be quicker than ever in order to determine if our applications are ready to ship or not.
That singular reason is why API testing is so important and why you should have it as part of your overall automation strategy.
There are lots of tools available for API testing as I covered in my previous post 14 Open Source API Testing Tools for REST & SOAP Services — but how do you choose?
These are the top five API testing tools I believe can help you, and why you might want to use one over the other.
Either way, they are all great options.
If you’re using Java, Rest-Assured would be my first choice for API automation.
Rest-assured is a fluent Java library you can use to test HTTP-based REST services. It’s designed with testing in mind, and it integrates with any existing Java-based automation framework.
I’ll admit upfront that this is the main tool I use for API testing. It provides a BDD-like DSL that makes creating API testing in Java simple. It also has a bunch of baked-in functionalities, which means you don’t have to code things from scratch. Bonus: if you’re like me and use the Serenity automation framework, Rest-assured integrates seamlessly with it, which means you can combine your UI and Rest tests all in one framework that generates awesome reports.
Testing and validating REST services in Java is harder than it is in dynamic languages such as Ruby and Groovy. This is one more reason to use REST-Assured since it brings the simplicity of using those languages into the Java domain.
The Rest-assured API is created so that you don’t necessarily need to be an HTTP expert.
If your team is made up mainly of Java coders, I highly recommend Rest-Assured for API testing.
Some folks don’t necessarily want to deal with coding in an IDE using the same language as their developers.
If you’re one of those people, you might want to consider Postman for some quick and dirty API testing without worrying about the overhead of some of the other options. Postman is also a nice option for exploratory-type API testing. But it’s also powerful enough that you can create more integrated solutions if you wish.
Postman is an easy-to-use Rest client and you can get started with it quickly leveraging its Chrome plugin. There’s also a native version for both Mac and Windows.
It has a very rich interface that many Rest clients don’t have, making it easy to use. It also enables you to easily share your knowledge with your co-workers, because you can package up all your requests and expected responses and send it off to someone else so that they can take a look at it also.
Big Fish Games uses Postman as a collaborative tool. According to Amber Race, an SDET at the firm, they have one person who does the research and figures out all the test cases for the API. They then publish that info to a Wiki so that anyone can run the API tests and ensure that what they’re doing doesn’t break existing API functionality. Postman even allows you to place a button on your internal website saying “Run in Postman,” and it automatically kicks off your Postman tests.
If your team wants to not only test APIs but also have a tool to help automate some of your exploratory API testing efforts, Postman is a great choice.
SoapUI has been around for a while now. If your teams are doing API testing only, and are composed mostly of QA engineers as opposed to developers, SoapUI might be the best choice for your team.
SoapUI is a fully functional test tool dedicated to API testing. Rather than having to create a solution from scratch, API allows you to leverage a tool full of functionality aimed strictly at API testing.
If for some reason you need to create a custom workflow or functionality, you can code up your solution in SoapUI using Groovy.
If your team has complicated API testing scenarios and is made up of more QA/Test Engineers, SoapUI is the tool I would try first.
Although JMeter was created for Load testing, many folks use it for functional API testing as well.
JMeter includes all the functionality you need to help test an API, plus some extra features that can be taken advantage of to enhance your API testing efforts.
For example, JMeter can automatically work with CSV files, which allows your teams to quickly create unique parameter values for your API tests. It also integrates with Jenkins, which means you can include your API tests in your Continuous Integration pipelines.
If you plan on creating API functional tests you would also like to leverage in your performance tests, why not kill two birds with one stone and use JMeter as your main API testing solution?
KarateDSL, which is pretty new, makes creating scenarios for API-based Behavior Driven Development (BDD )tests really simple since unlike most BDD frameworks (Cucumber, JBehave, and SpecFlow), you don’t need to write step definitions. The reason for that is that Karate has already created all the step definitions you need in order to get started testing APIs.
If you’re into newer technology and your team is already using Java and Cucumber, then KarateDSL might be the perfect choice for you.
Fiddler is a tool that allows you to monitor, manipulate and reuse HTTP requests. Fiddler does many things that allow you to debug website issues, and with one of its many extensions, you can accomplish even more.
One of those – the APITest extension — greatly enhances Fiddler to validate the behavior of web APIs. (Validators offer a lightweight way to judge the success or failure of a test.)
For more hardcore API testing development you can use the FiddlerCore.NET Class Library to build their API Testing infrastructure.
This is a great choice for teams that use .NET languages since you can develop your tests using any .NET languages you wish.
Which API Tool?
There are no perfect tools. Each group has different requirements. Virtually all API test tools work pretty well and are great options, depending on your team’s needs.
There are many other API test tools available, but these are my top five. What are yours?