Big news for all Java programmers out there.
Now you can use Cucumber with pure Java!
That’s right, you don’t have to write a single line of Ruby! (1)
All of your step definitions can be written as annotated methods in
(Plain Old Java Objects).
To get a taste of what this looks like, check out the simple example in
cucumber_java project on GitHub:
- README for example:
- Some sample step defs:
- The main page:
By this I hope Cucumber will reach a bigger crowd. Much bigger crowd
actually - this will work for Scala, Clojure, Jython and all the
cool JVM languages too.
(I’ll be doing something similar for .NET, which will bring Cucumber
goodness to C#, F# and whatever languages run on .NET. But IronRuby must
catch up on speed first).
I had the pleasure of going back to visit PicoContainer - a pioneering
lightweight dependency injection container I developed with Paul Hammant
back in 2003. It’s still lightweight and a joy to use (relatively
Java in itself isn’t joyful). Cucumber-java uses PicoContainer to
instantiate the POJOs that define the annotated step definition methods,
if you’re so inclined, these classes can depend on each other via
constructor DI, and PicoContainer just figures out how to instantiate
So if you’re working on a Java project, have been looking at Cucumber
stayed away because of all the weird Ruby, this is your chance. Here is
cuke for Duke!
(: Aslak (:
(1) You still need a tiny bit of Ruby to register step definitions:
(This will hopefully go away in the future, with some better Ant and