Chapter 5. Testing a REST Web API

In this chapter, you will learn how to test a REST web API. As we will see, publishing a specific functionality as a REST web API is not simple and involves a lot of corner cases. Fortunately, there are a lot of tricks we can use to make our life easier.

In this chapter, you will learn the following topics:

  • How to make a very fast test suite that can run around 150 tests per second to drive a REST API
  • Why we should isolate the tests of the REST API from the tests of our business layer and how to do this efficiently
  • The main design patterns for our test suite when dealing with REST APIs

The approach

We have already coded a feature for the myCafé application; now, we have been asked to publish this feature as a web API. ...

Get Learning Behavior-driven Development with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.