How Do I Test Thee API?
Let me count the ways.
- Alone. In the dark, or with the light on. Does it return the expected status? Does it do what we expect it to do? You know, the absolute simple stuff.
- With different inputs. Different paths, different parameters, different bodies. Changing parameters is good. We can tell a lot about an API by using it with different inputs. Also, we’ll also find the behavior that’s not documented.
- With a document. Does it do what it actually says it should do? Does it hold information from us? Are all the things it promises actually tested? Can we trust that documentation?
- With friends. No API is an island. It’s also spelled differently. APIs are used in different workflows and scenarios. In the beginning, the end, and sometimes in the middle. There’s a cross-contamination or cross-pollination, when used with their API friends in a combination. There’s no social distancing with APIs.
- With repeats. Create a disturbance in the Force, like millions of voices suddenly decide to call the API. At the same time. Or one after another. Oh, the surprises we’ll experience.
- In another place. Does it speak Burmese? How does it behave when an umlaut is around? Can we call it even from Wuhan, and what would be the result?
- In another time. Call it on February 29th, call it coming out on Daylight Saving Time. Just look at your watch and call it. You’ll have the time of your life.
- In another setting. Big or small memory, locally or through a proxy, from the UI or pretending to be another computer. The options are endless. And you’ve got the time, right?
You see guys, a single API can fill up your day with just thinking about how to find out how it works. And that’s just one!
Well, that’s the job though. And I’m sure I haven’t thought about all the ways, so give us a comment if you have an idea.
If you want to take on a challenge, this is just a tip of the iceberg of what I teach in my Testing APIs With Postman course. Nobody should miss it. Call me now!