BDD Framework like Cucumber aims to bridge gap between business and technology. In BDD we describe behavior of software as plain text in .feature file. Cucumber helps us wrap business language around test code so that there is better visibility and tests are not lost in code. Sharing documentation within and across teams is an important aspect and there are currently different solutions available to host and share .feature files. I have used Relish in the past for hosting feature files online. Cucumber.pro also looks promising for collaboration. I came across a post from Shashikant here about living documentation using Yard-Cucumber and wanted explore more. Yard-Cucumber is a free tool which can be used to generate documentation interface to view features, tags etc. It generates HTML files and is a nice interface to search/view features and tags. In his blog post Shashikant shows how to use Yard-Cucumber for a ruby cucumber project. I attempted to use Yard-Cucumber for a cucumber-jvm project and share my experience in this blog post. Here are the steps,
Make sure you have
ruby 2.0.0 installed
Go to your project and install bundle if its not installed already.
gem install bundle
This will create a Gemfile in your project. Add gems below,
Now lets create Rakefile and add contents below,
YARD::Rake::YardocTask.new(:yard) do |t|
t.files = ['src/test/resources/features/**/*.feature', 'src/test/java/**/*.java']
Now Yard-Cucumber is configured successfully and now you should be able to run the tool to generate reports,
bundle exec rake yard
Now you should see doc folder under your project. index.html should be the launching pad. My sample project is hosted on github here and you can take a look at my docs over here (give it a few seconds to load).
Some images from my project are like,