Read more

A nicer way to run RSpec and/or Cucumber

Henning Koch
June 10, 2011Software engineer at makandra GmbH

See https://github.com/makandra/geordi/ for the current state of these scripts.

geordi Show archive.org snapshot , our collection of awesome shell scripts, has been extended by three scripts to help you call RSpec or Cucumber:

cuc

Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

This script runs Cucumber the way you want it:

  • Prints some line feeds to easily find your test results when you come back to the console later
  • Configures Cucumber to use cucumber_spinner Show archive.org snapshot if it is available in your Gemfile
  • Runs Cucumber under bundle exec
  • Uses an old version of Firefox for Selenium (Javascript) features if you setup your system that way
  • Runs features in parallel if parallel_tests gem was found in you Gemfile and no rerun.txt with content exists
  • [UPDATE] You can pass all cucumber command line options to the cuc script even if the tests are executed with parallel_tests.

Example usage:

cuc # runs all features
cuc features/users.feature # only run one feature
cuc -f pretty -t wip features/users.feature # run one feature with parameters like cucumber

rs

This script runs RSpec the way you want it:

  • Prints some line feeds to easily find your test results when you come back to the console later
  • Calls RSpec 1 (spec) in a Rails 2 project and RSpec 2 (rspec) in a Rails 3 project
  • Configures RSpec to use rspec_spinner Show archive.org snapshot if it is available in your Gemfile
  • If rspec_spinner is unavailable, switches on color output
  • Runs all examples in spec if you don't give an argument
  • Runs RSpec under bundle exec
  • Runs examples in parallel if parallel_tests gem was found in you Gemfile

Example usage:

rs # runs all examples
rs spec/models/user_spec.rb # only runs one example

tests/test

This runs all your tests for a full check against regressions:

  • Deletes a rerun.txt from earlier Cucumber failures
  • Runs rs
  • Runs cuc if rs succeeds

You can install all the scripts in the geordi toolbox by saying

gem install geordi
Posted by Henning Koch to makandra dev (2011-06-10 18:05)