Chapter 3. Writing BDD Features

Although in the last chapter, you learned how to use Mocha, Sinon, and Chai to code some BDD tests, it was not so clear how we can write a good feature, given a set of requirements. In this chapter, we will go through the following topics:

  • Exploring in greater depth how to write good features. For this, we will work on a more realistic example: myCafé, an imaginary start-up.
  • Since myCafé is a JavaScript server, we will need to implement its functionality using asynchronous programming, so we will learn how to test asynchronous code.
  • We will explore more techniques to organize your test codebase so that we can make it more expressive and reuse code across different features.

What we are not going to see in this chapter ...

Get Learning Behavior-driven Development with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.