Skip to content
This repository was archived by the owner on Nov 16, 2018. It is now read-only.

Running Features

aslakhellesoy edited this page Aug 13, 2010 · 27 revisions

There are several ways to run your features. This page lists the most common ones.

Using the Gem’s ‘cucumber’ Command

Assuming you’ve installed cucumber as a gem, run this at a command prompt to see the options for running features:

cucumber --help

For example

cucumber features/authenticate_user.feature --line 44 --format html > features.html

…will run the scenario defined at line 44 of the authenticate_user feature, format it as HTML and pipe it to the features.html file for viewing in a browser.

Defining ‘profiles’

Profiles allow you to store and reuse commonly used cucumber arguments for a project in a cucumber.yml file. For example, by having this in your cucumber.yml at your project root:

default: --format profile features
html_report: --format progress --format html --out=features_report.html features  

You can reuse the arguments listed above:

cucumber --profile html_report

It is important to point out that by simply running ‘cucumber’ the default profile will be used (if a cucumber.yml file is found).

Using Rake

From the command line:

rake features

This requires a Rakefile with a Cucumber task definition. For example:

require 'rubygems'
require 'cucumber/rake/task'

Cucumber::Rake::Task.new(:features) do |t|
  t.cucumber_opts = "--format pretty"
  t.rcov = true
end

If you are using Ruby on Rails this task is defined for you already.

Using TextMate

See the Cucumber.tmbundle documentation

Using Ant

TODO: Show a simple task

Using Maven

TODO: Show a simple task

Clone this wiki locally