What is cucumber-jvm?
Context:
Cucumber was first written in Ruby and supported multiple languages, though we know that generally a library written using a programming language aligns much better with that programming world. For example, if you ask me to use a .dll file in my java program as an api layer – I would have one of those faces..yeah “wtf” faces.
Does that mean I can never use a dll in a java program? No ! There are situations where we might have to have bridges between programming language barriers and java does that with JNI. So it is not to say it is impossible. It would just not be a great idea.
Hence Cucumber was used extensively in Ruby world and not much adopted in the Java world or .NET world for example.
Java world is too big and there are so many solutions, libraries and Test Automation solutions. Anyways, to whittle it down to our discussion on the web automation side, some of the tools that work well hand in hand with a Java based solution are Selenium, TestNG, Apache POI, jax and jars that can be plugged in any time.
Hence cucumber was NOT that popular in Java world. But does that mean we did not have a way to execute Java via cucumber at all . Nopes ! We already talked about it extensively how Java and Ruby worlds can co-exist and how we can use Java libraries with our Ruby code.
However still the adoption of cucumber in Java space is minimal compared to the Ruby world.
cucumber-jvm
cucumber-jvm is a pure Java implementation of Cucumber and runs on a jvm with JIT compiler. At this point in time [Dec 2014], we don’t find many articles or information or documentation on how to set up a simple Java project, use cucumber-jvm library and get the smooth experience what we have with cucumber and ruby in general.
I find the gihub source code for cucumber-jvm as the most up to date source of information i.e. dig through the code and learn by reverse engineering more or less. This is generally not a comfortable idea for most of us right ! So I will try my best to present the information I learn in a succinct manner on this website.
cucumber-jvm is on a very ambitious route to support so many languages and frameworks. Just take a look at the github repo – android, clojure, gosu, groovy, guice, java8, jruby, jython…..
Why should I use cucumber-jvm
Frankly if you are already using cucumber and in the Ruby world, you don’t have to. If you plan to learn Test Automation using Selenium then also, you don’t need to learn as the tutorials on this website are good enough to meet your Test Automation requirements using Cucumber, Ruby and Selenium web driver.
Then why ?
Reason 1:
Well, if you already are a java programmer and have been with it for many years and you are in a java shop and your focus is to deliver solutions but NOT get into language wars…and blah blah [we talked about it in Choosing automation solution], BUT you want to use the BDD framework offered by Cucumber, then cucumber-jvm seems to be the fastest route to get there.
Reason 2:
That is you want to have ATDD/TDD implemented – express behavior of application in terms of acceptance tests [automation code in step definitions behind the cucumber gherkin] , fail them and developers write source code to make them pass, then once again you need cucumber framework.
Reason 3:
You like Eclipse, TestNG, Junit , maven, gradle etc. tools in the Java world and want to stick with them AND want to use cucumber AND have as smooth experience as one would have with Ruby+Cucumber+RubyMine+Gems world — cucumber-jvm seems to be the answer again. More so, because you don’t want to be having to use 10 different IDE’s tools, libraries and so on. Makes life a PITA right.
More reasons
I will add others as and when I have them presentable….
So where do I start
You have already started by reading this content. We will provide step by step instructions on setting up cucumber-jvm with all your favorite IDE’s and libraries and tools or whatever.
Keep visiting this website and you will find something new every time you visit.
Excited?
If you are not excited yet to start on cucumber-jvm, you should be. I am definitely. Having worked in Java and Ruby world for quite some time, I really wish we can bring these worlds together. Also because we can apply ATDD,TDD,BDD which seem to align so well with Continuous Test Automation.
Disclaimer
cucumber-jvm is being updated almost daily. Its an open source project yo!