You have two options for working Behave, Cucumber and Ruby:

  • The command line client
  • Rake build scripts

Both require the Behave gem to be installed

Installing the Behave gem

The gem is hosted on RubyGems at and is available direct from the website or using RubyGems. Assuming you have Ruby and RubyGems installed on your system, run

$ gem install behave

and you will have installed the behave ruby client and its dependencies. Depending on your system, you may have to prefix the command with "sudo"

Using the command line

Installing the gem will have placed a binary on your path named "behave". The output of "behave --help" is as follows:

Usage: behave [options]

Specific options:
    -h, --host HOST                  Host URI for JIRA installation - This should be
    -u, --user USER                  User ID from the JIRA Project Admin Page
    -p, --pass PASS                  API Key from the JIRA Project Admin Page
    -k, --key KEY                    Project ID from the JIRA Project Admin Page
    -d, --directory [DIR]            Specify output directory (default 'features')
    -m, --manual                     Include manual tagged scenarios in download
        --proxy PROXY_URL            Pass requests through a PROXY_URL
        --bypass-ssl                 Bypass SSL certificate checking
        --help                       Show this message
        --version                    Show version

An example call could look like this:

$ behave --host \
  --user aalyYToxMDgzMjAyMM== \
  --pass 834a65e809a0ab22696e7e307d222a4887aa0078 \
  --key 10100 \
  --directory features \

This would download all .feature files from the PROJ project to the features directory (relative to the directory behave was run from), including all scenarios tagged as manual. Host and Key are the only required arguments, which defaults to an anonymous login downloading all features to the directory the command is run from.


You are more than likely to be using Rake in your Ruby project for scripting your builds. Cucumber comes with its own Rake task ready for you to use and looks like this

require 'cucumber/rake/task' do |t|
  t.cucumber_opts = "--format pretty"

This cucumber task can be executed using the following command

rake features

As our Features and Scenarios are stored within JIRA we will need to download them. To do this we will add a new Rake task that will download them using the "Behave" Ruby gem.

require 'behave'

desc "Download features"
task :download do{
    'host'   => '',
    'user'   => 'aalyYToxMDgzMjAyMM==',
    'pass'   => '834a65e809a0ab22696e7e307d222a4887aa0078',
    'key'    => 10100,
    'dir'    => 'features',
    'manual' => true

This task can be executed using the following command

rake download

We can now download our Features and Scenarios from JIRA but we will always have to remember to run "rake download" before "rake features". To avoid this we can configure the Cucumber "features" task to depend on the Behave "download" task and execute it before running Cucumber. This just requires one additional line in your rake file.

task :features => :download

The full Rakefile can be found in the example project on Bitbucket


If you need to specify a proxy to pass requests through, use the --proxy flag from the command line or pass 'proxy' => 'MY_PROXY' argument into FeatureDownloader i.e.

$ behave --host \
  --proxy https://some.proxy.url


task :download do{
    'proxy' => 'http://some.proxy.url'

Bypassing SSL

If you experience problems with your SSL certificate, you can bypass SSL checking in behave by using the --bypass-ssl command line flag, or the 'bypass_ssl' => true FeatureDownloader argument.

  1. Prev
  2. Next