Summary

In this chapter, you learned how to use Gherkin and Cucumber.js to write BDD features. This has been a long and hard chapter, because you not only needed to learn a new tool, Cucumber.js, but you also needed to build a set of utilities to make your life easier.

Always write features and scenarios in a language that makes sense and is understandable to the stakeholders. Avoid technical details, such as database structure, identifiers, or low-level operations, in your Gherkin.

It is a best practice to create a custom world object. The world object will be instantiated once before each scenario, so it is a good place to store any information that needs to be accessed by all the steps in the same scenario. In general, keep the code in the step ...

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.