Java Cucumber (cuke4duke) Spring 3 and Selenium Test Jump Start …
Recently I worked on a Ruby On Rails Project using rake, rspec, cucumber and celerity and I really enjoyed this suite of tools. More recently I started a side-side Project that is Java based but I wanted a similar set of tools, especially Cucumber as this allows the other people involved to write scenarios that are then progressively implemented by others. Cucumber support for Java (and other languages) is available through the Cuke4Duke Project.
The out of the box examples from the Cuke4Duke project get you started but I wanted more, I wanted a Project that:
- Was automated, with unit-test, integration-tests and Web Based interaction tests.
- Was able to run against different Web Browsers through simple configuration.
- Was able to run without using a browser when this type of interaction took too long.
- Was able to be added simply and quickly to a Continuous Integration Server.
- Was a small initial download and didn’t require a lot of configuration or knowledge to get running.
I took the out of the box examples for spring and web driver from cuke4duke and combined them together with some Maven magic and produced a simple Hello World Web Application with almost all of the attributes I wanted. I also added some placeholder classes, unit tests, integration tests and a cucumber scenario. The Page Object pattern and the excellent PageFactory tools are also used to provide an example of driving the Web Application through Scenario Steps.
The goal of the Skeleton is to jump start my own and possibly your own projects using BDD and TDD and lots of automation to get you from A-to-B quicker and with more confidence in the result.
You can get the skeleton project from gitHub or download it here: maven-cuke4duke-jump-start
Or just do these commands:
git clone http://github.com/jamesladd/maven-cuke4duke-jump-start.git
cd maven-cuke4duke-jump-start
mvn -Dcucumber.installGems=true cuke4duke:cucumber
mvn clean integration-test
To start the project building and see it in action check the README file.
*NOTE* When building the maven project for the first time there is a *LOT* of cuke4duke dependencies downloaded, but just the first time. It takes a while, but only the first time.
And now the weird part, if on the first run the Cucumber steps fail, run mvn clean integration-test again. This also only has to be done once and from then on all work without error.
UPDATE: I have added maven profiles to the project so you can now choose which Web Browser to use to drive the web site, for example, -P chrome will use the Chrome browser. This is documented in the README. With this feature you can configure your Continuous Integration server to run the build for each browser you support.
UPDATE: Added database setup and migration support using Liquibase and HSQL.
UPDATE: Added support for Cuke4Duke V0.3.0

July 13th, 2010 at 2:59 am
Using Cucumber tests with Maven and Java…
What’s that? You like using Cucumber and want to use it with your Java project but your company ecosystem is not hip to JRuby? Enter the cukes4duke project, which allows you to run cucumber with most JVM-based languages.
……