Summary

Testing against external systems is expensive! One problem is that setting up the external system in a known state is hard, especially when testing against a third-party system that is not under our control. The other problem is that they can be slow due to connectivity problems.

We can do the setup and assertions using a low-level API or the provided client library directly. This approach generates duplication of code between the test and the production codebase. Instead, I often prefer to use this kind of low-level API only for setup and then write the tests of the DAO, or custom service client, using the read methods of the DAO to write assertions.

If you are testing against a web API, then using the record-and-replay approach is usually ...

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.