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

Testing against external systems


So far, we have learned a simple technique to maintain the integrity of our test doubles. The problem comes when we need to implement a system that should implement the interfaces represented by these doubles.

Actually, the really problematic case is when we need to test against an external system, because we cannot make a test double for the external system, the database, or the platform. After all, we are trying to test the code layer that talks directly with them. We have reached the boundary not only of our system, but also of our runtime. In these cases, we can only test this code in integration with the external system, so we need an integration test. The following figure illustrates testing against external systems:

Reaching the end of the world

We already saw that the actions and assertions of our tests should be consistent with the setup we made in the tests of the consumer, but how do we set up if we cannot use test doubles again? Well, it depends...