Tuesday, March 01, 2011

Cucumber DSL for Selenium Testing - Take 1

I have had a few hours to play with Cucumber tests using cuke4duke by Aslak Hellesøy, a very useful addon to Cucumber which makes it possible to write step definitions in several JVM languages. I have gotten it to the point where I can write Cucumber Features and Scenarios for very basic tests. I hope to write in more detail about my full findings and thoughts later on.

I have set it up so that it can be built in Maven. The pom.xml file can be located here. The project structure is pretty simple and can be structured as follows:



|-features
|-brandhub.feature (source can be found here
|-src
|-test
|-java
|-sample
|-BrandHubSteps.java (full source can be found here)
|-pom.xml (source can be found here)



All you then need to do once you have the above structure is run mvn clean integration-test and you should be on your way. Your test results can be found in target/surefire-reports. I have included html and junit reports. You will also find that there is a pretty console log of your features and your scenarios.

Please note that the first time you run you will need to append the following system property to your maven command line:

-Dcucumber.installGems=true

This will make sure that the cuke4duke Ruby gem and its dependencies are installed. If you don't do this, you will most definitely get an error along the lines of:

Error opening script file: /.jruby/bin/cuke4duke

Let me know what you think.

Peace and Love.

1 comment:

Anonymous said...

There is an article over here about Cucumber and new Capybara dsl, checkout: http://inancgumus.com/66712574