Chapter 9 Testing APIs

Design and Build Great Web APIs — by Mike Amundsen (68 / 127)

The Pragmatic Programmers
The Pragmatic Programmers

--

👈 Part 4 The Release Phase | TOC | The Goals of API Testing 👉

So far, we’ve focused on the sketch-prototype-build pattern to move from ideas to full implementation of your API. In this part of the book, we’ll focus on other important elements of designing and building great APIs, including the role of testing, securing, and deploying APIs. In reality, you’ll be dealing with these issues throughout the design and build process. But bringing up all these things at the beginning of the process makes for a confusing book! Instead, I opted to save these details for a bit later so that we could spend time working through them individually.

In this chapter, we’ll explore the world of API testing. We’ll start by taking a look at the goal of API testing and some basic principles behind that goal, including behavior-driven and happy path/sad path testing concepts.

images/testing/2020-04-testing.png

We’ll also look at a simple form of testing (validation, really) that I call simple request tests, or SRTs. These are just calls to a URL to confirm that the URL is working and that the input and output information seems to be what was expected. This isn’t really API testing in depth, but SRTs come in handy for quick validation of URLs as you’re writing your code.

--

--

The Pragmatic Programmers
The Pragmatic Programmers

We create timely, practical books and learning resources on classic and cutting-edge topics to help you practice your craft and accelerate your career.