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


In this chapter, you learned some of the following tricks to write better features:

  • Decompose the system into the principal entities. Then analyze which actions each role can perform on each entity. For each action you discover, there must be a feature.

  • Do not forget that the act of displaying or showing information is an action itself, so it needs its own feature.

  • Decompose a feature in a set of scenarios where each scenario represents a different setup or input data that will lead to a different outcome.

  • We need a specific test for each outcome of each scenario.

  • The returned data is not the only possible outcome, but there can be side effects and available actions.

  • Test an asynchronous system based either on callbacks or promises.

  • Build asynchronous test doubles using either callbacks or promises.

  • Test doubles should faithfully resemble the technology we use to access external systems, databases, and other features. This includes not only the interface, but also the resulting data schemas...