ECE 2524 - BDD With Cucumber

ECE 2524

Introduction to Unix for Engineers

BDD With Cucumber

Running tests locally

The instant feedback and auto-running of tests is still a work in progress. As I am working to squash bugs (and even after), you may find it convenient to run tests locally.

Tool Setup

Cucumber is a ruby application that executes automated tests written in a human readable format called Gherkin. Originally written to implement Behavior Driven Development (BDD) for web applications, the aruba extension adds support for testing command line applications as well. To install aruba you will first need a working ruby and rubygems install. Usually the easiest way to go about this is to use rvm. In the past, the Ubuntu packages associated with ruby have been riddled with version compatibility issues. See How to install Ruby (and RVM) on Ubuntu if you are having trouble getting this to work on Ubuntu, especially version 12.04 or earlier. Once that is done (ruby -v should return a version >= 1.9.3) you can install the aruba gem:

$ gem install aruba

Running tests

Once you have aruba installed you will need to grab the features description for the current project, for example, fdtest

$ cd ~/ece2524/fdtest
$ git submodule add ece2524git@ece2524.ece.vt.edu:features/fdtest.git features
$ git commit -m "add features submodule"

you should now have a directory named features as a subdirectory of your fdtest project directory. Now you can run cucumber:

$ cucumber

Note: Especially early on the test description may change as bugs are reported to me. You may want to periodically update the features submodule to make sure you are running the most up-to-date tests:

$ cd ~/ece2524/fdtest/
$ git submodule update