API testing perspective

Being in the business of testing APIs for more than five years, I often get questions on how it is done and how it is different than other types of testing. Let me explain some basics in this post and some other day, we’ll talk in-depth.

The user in API world is Programmer. The first thing that makes API testing so special is that the consumers of API are 3rd party or the fellow programmers in your team or organization. Now testers are User’s agents and they should exactly do what a user would do. So the tester in API world would be a Programmer that writes tests, samples, widgets, apps, stuff using the delivered API.

That is why in some teams, one of the Programmers takes this role of tester. Or if you prefer to hire a tester (as we do here), you should look for people with strong programming skills who still want to be testers.

API testing perspective

It’s all automated, by default. Since API testing is not called “Automated API testing”, people may assume that part of it is manual and part automatic as happens in usual test projects. But nay, every thing is automatic by default and there are lots of tools to help you out. So the process of building the test code, running the test code and shipping a healthy build is and should be done automatically. Even best is to incorporate every thing through Continuous Integration. The Unit testing tools along with home grown test infrastructures are the hallmarks of an API testing project.

It has to be a joint venture. Though ideally Programmers, Designers, Architects, Business people should take interest in every testing project but what happens is that the ownership of a Testing project remains with the Testing team in most of the cases. It changes in the API testing world, where Programmers take a good part in designing and coding the test infrastructure and writing unit tests. The Testers then add value by writing more complex scenario tests.

Technology really matters. If you are testing a Desktop API or Web API or Mobile API, the scene changes altogether. Similarly your tools and approach towards API testing will be largely driven by Technology. For example, if GoogleTest is used to test C++ APIs, you might use NUnit for .Net APIs and so on. Normally, the language used to write the API is used to test the API again because the Programmers will use the same language e.g. C++ API will be used in C++ applications vs. REST API being used in Web applications.

Maintenance is the challenge as with all coding projects. Needless to say the biggest pain for any coding project is maintenance. People come and go and API features come and go. The API test code needs to be maintained all the time to reflect the current state of the underlying API it tests. Any techniques used to keep your code base maintainable are applicable for API testing projects.

Have you been part of API testing teams? And what are your main takeaways for others?

Tags: ,

One response to “API testing perspective”

  1. ridhamalik says :

    Nice Post .Now a days I am learning about how to test rest api .It is interesting 🙂

    Like

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