Book Image

Learning Behavior-driven development with Javascript

Book Image

Learning Behavior-driven development with Javascript

Overview of this book

Table of Contents (17 chapters)
Learning Behavior-driven Development with JavaScript
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 a good alternative, especially if the connection is unreliable, slow, or we do not have an exclusive and trustworthy test environment. This adds complexity to our test workflow, since the setup must be generated with a special library that runs...