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

Chapter 9. Testing Against External Systems

In this chapter, we will have a brief look at what happens when we want to test code that depends on another system. How should we approach such a task? Should we do it?

This is a difficult question that has no easy answer, so in this chapter I will show you some techniques that can help you in this subject. This way, you can evaluate whether applying any of these techniques is suitable for your specific case and, if so, whether it can really pay off.

In this chapter, we will learn the following topics:

  • Tips on how to write test doubles that are consistent with the expected collaboration between two subsystems or problem domains.

  • We will see how to test the code that accesses databases. This technique can be used to test the code that accesses the filesystem or other kinds of storage infrastructure.

  • We will explore what happens when we try to test the code that accesses external systems that are not in our control.

  • We will see the record-and-replay technique...