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


Wow! This was a long chapter, but we covered a lot of ground. You learned the basics of Node and NPM, just enough to be able to set up a simple development environment for BDD. Node allows us to execute JavaScript from the command line, something that is essential to perform BDD. With NPM, we can initialize our project, manage its dependencies, and install tools and libraries, such as Mocha and Sinon.

We practiced the test-first cycle, Red/Green/Refactor, using Mocha and Chai. During your first contact with the test-first cycle, you learned not only how to use the tools and libraries but also some useful testing techniques:

  • Adding duplication to your code with triangulation, to expose patterns that help you discover the correct algorithm and design you need to use.

  • Knowing how a bug can lead to a new failing test or change the existing ones, to reflect our new understanding of the system.

  • Organizing test code in Mocha to avoid duplication using parameterized tests and the before and...