Getting Started with API Testing
I constantly see questions from testers about how they should get started in test automation. Normally, they have been working in software testing for a few years and became aware of the thick glass ceiling. They are now at a point where they want a bump in title, money, or status in the company they work for (most likely, all three).
My recommendation for starting in test automation is always to learn to write a little code, but that isn’t very helpful. More specifically, I will probably suggest working with the API. Here are a few tips on how to actually get started with API testing.
Most people I talk with about automation want to jump right into tooling. I usually prefer to think about testing first. I was working on a platform that helped marketing staff build advertisements and get those ads in social media streams such as Facebook, Twitter, and Instagram. Marketers used a web front end to get their work done, but the product was built on a REST API. We had an API endpoint for each type of ad, and each endpoint had its own set of keys and some combination of optional and required data.
There were two main aspects of the testing I had to focus on: data and workflow. I usually started by taking a look at the documentation or code, if we didn’t have any docs, to see what fields were available. Each of those fields has a data type and length that I needed to take into consideration. From there, I created some light documentation to capture test ideas.
For a date field, I might send today’s date, something out of bounds in the past, something out of bounds in the future, and something that isn’t a date at all. The goal is to discover whether good values persist, and how the system fails when I send something “bad.”
After working through a plan for testing data, and updating and pivoting as I make discoveries, I moved on to focus on workflow. For me, this sort of testing helps to answer the question “What bad things might happen when someone tries to use this product?”
I made a plan to start with the normal advertising workflow, created a new ad campaign with start and end dates, inserted it into a social stream, made sure it starts, looked at metrics from people interacting with the ad, and made sure it ended on the right date. In one case, I discovered that ads that were in the live date range were still editable by performing another method.
If you are about to jump into API testing, my suggestion would be to focus on the testing. There are visual queues that move testing forward when we have a UI. Finding those in an API can take some think time. The decisions about what tools and frameworks you use, and how to get them running in CI, is usually an easy choice you only have to make once. Testing is the hard part.