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

Cucumber.js or Mocha?


Which is better? Cucumber.js or Mocha? There is no clear answer to this question, but here is my advice: if you have engaged stakeholders who are willing to read or even write the Gherkin code, go for Cucumber.js. If you are not in this (fortunate) situation, then using Cucumber.js is not so attractive.

Even if you are in this situation, you need to think twice before using Cucumber.js, specially if you are new to BDD or JS. The main problem with Cucumber.js is that you need to invest a lot in the test support code that translates the Gherkin to real code. This effort is wasted if the stakeholders are not going to, at least, read the Gherkin code and give you feedback on the intended behavior of the system.

On the technical side, the Cucumber.js tool itself is a bit immature, specially compared to Mocha. I specially miss the support for promises, better assertion failure reporting, a simple API to deal with tables, or a simple way to call one step from another. These...