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

Getting started with Gherkin and Cucumber.js


Gherkin is a domain-specific language, specialized in describing features and scenarios. The point of Gherkin is that it is extremely similar to natural language, so similar that domain experts can read and understand features written in Gherkin or, in some lucky cases, write them themselves.

This is a very important advantage, since BDD aims not only to automate tests, but also to improve communication between domain experts and software developers.

To introduce the Gherkin language, we will migrate to this language the "display order" feature we coded in the previous chapter, and then we will automate it using Cucumber.js.

For brevity, I will not show system error scenarios. Keep in mind that, if you were writing a real application, you would need to add scenarios about these kinds of errors. You need to address things such as what happens when one of the external systems, such as the orders database, is down!

Preparing your project

We can prepare...