The cuke_commander gem provides an easy and programmatic way to build a command line for running Cucumber.
Add this line to your application's Gemfile:
gem 'cuke_commander'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cuke_commander
require 'cuke_commander'
# Choose your Cucumber options
cucumber_options = {tags: ['@tag1', '@tag2,@tag3'],
formatters: {json: 'json_output.txt',
pretty: ''},
options: ['-r features']}
# Use the generator to create an appropriate Cucumber command line
clg = CukeCommander::CLGenerator.new
command_line = clg.generate_command_line(cucumber_options)
puts command_line
# This will produce something along the lines of
# cucumber -t @tag1 -t @tag2,@tag3 -f json -o json_output.txt -f pretty -r features
# Use the command line to kick off Cucumber
system(command_line)
Simple!
(see documentation for all implemented Cucumber options)
See CONTRIBUTING.md
The gem is available as open source under the terms of the MIT License.