Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cucumber-java vs. Cucumber.js

My team is developing a Java web system using the Play framework and implementing Angular.js throughout. My question is, should I use Cucumber-java or Cucumber.js for automated BDD functional testing? What are the pros and cons of each when using them against this technology stack?

I've found very little online about which to use with this particular technology stack.

like image 632
Chris Traynor Avatar asked Jul 09 '26 14:07

Chris Traynor


2 Answers

Firstly, the Cucumber is designed as a collaboration tool. If you're looking for a test automation tool, then you're probably best off choosing something that doesn't add the overhead of devising and maintaining a plain-English, ubiquitous language.

If you are collaborating with non-technical stakeholders, then Cucumber is a good choice. The whole team will collaborate writing the scenarios, but it will be the devs and testers that write the 'glue' that links the scenarios to the application you're building. If you choose Cucumber-JVM you'll write the glue code in Java/Groovy (or other JVM language); if you choose Cucumber-JS you'll write the glue code in Javascript. So, one of the questions to ask is "what language will my testers and devs be most comfortable using?"

You'll probably mostly drive your app through an interface that it exposes(e.g. the GUI or a published RESTful API). Whichever Cucumber you choose, your 'glue' code will use some other library to interact with your application (e.g. Selenium WebDriver), so another question to ask yourself is "are the libraries I need available for Java or Javascript?"

Sometimes you might want your 'glue' code to talk directly to your application code. Cucumber-JS 'glue' can easily call Javascript directly, Cucumber-JVM 'glue' can easily call Java directly - so that might affect your choice. Remember, though, that only a minority of your scenarios will normally bypass your application's interface, so if this is your major stumbling block, you should revisit your approach to BDD. Some of these tradeoffs are also discussed in these slides

Finally, my feeling is that Cucumber-JVM is currently more mature than Cucumber-JS. Aslak Helesøy and Julien Biezeman are founders of Cucumber Ltd (along with Matt Wynne), so I expect them to reach parity at some point. For more information about Cucumber take a look at their online videos or <personal_plug>buy The Cucumber for Java Book</personal_plug>.

like image 177
Seb Rose Avatar answered Jul 13 '26 21:07

Seb Rose


Before signing a vendor-lock from the open source perspective I would compare:

  • number of open issues, the less the better, no serious issue should be left open for years
  • number of unapproved pull requests, the less the better, no request should be left pending for months
  • what the key developers say about their product
  • your estimated technology learning costs
  • ...?

Cucumber-JVM

  • Issues: GitHub: /cucumber/cucumber-jvm/issues
  • Pull requests: GitHUb: /cucumber/cucumber-jvm/pulls
  • Heroes: GitHub: /cucumber/cucumber-jvm/graphs/contributors enter image description here → Aslak’s view of BDD, Cucumber and automated testing, December 12, 2014

Cucumber.js

  • Issues: GitHub: /cucumber/cucumber-js/issues
  • Pull requests: GitHub: /cucumber/cucumber-js/pulls
  • Heroes: GitHub: /cucumber/cucumber-js/graphs/contributors enter image description here → Cucumber.js for BDD in JavaScript: An Interview with Julien Biezemans, April 15, 2014

User's voice may be also a good indicator but that would fall into the site's off-topic category

primarily opinion-based

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.

like image 25
xmojmr Avatar answered Jul 13 '26 19:07

xmojmr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!