You are previewing Test-Driven Infrastructure with Chef.

Test-Driven Infrastructure with Chef

Cover of Test-Driven Infrastructure with Chef by Stephen Nelson-Smith Published by O'Reilly Media, Inc.
O'Reilly logo


Cucumber-Chef is distributed as a Ruby gem. It depends on Chef and shares many of the same dependencies as Chef, so it make sense to install this as part of the Chef gemset you created in Chapter 3. Installation should be as simple as:

$ rvm gemset use 1.9.2@chef
$ gem install cucumber-chef

Cucumber-Chef consists of two portions: a command line tool for managing your test environment and tests, and a library of code for automating the provisioning, management, and testing of containers. We’ll explore the code library in detail in the next chapter, and cover the command-line tool in this one.

At its heart, cucumber-chef is a Thor script.[21] Thor is a tool for building self-documenting command line utilities, which handles command line parsing and has a rake-like approach of having various tasks that can be run. To list the tasks, run cucumber-chef by itself:

$ cucumber-chef
  cucumber-chef displayconfig           # Display the current config from knife.rb
  cucumber-chef info                    # Display information about the 
                                          current test lab
  cucumber-chef connect                 # Connect to a container on the test lab
  cucumber-chef help [TASK]             # Describe available tasks or 
                                          one specific task
  cucumber-chef project <project name>  # Create a project template for testing an 
  cucumber-chef setup                   # Set up a cucumber-chef test lab in 
                                          Amazon EC2
  cucumber-chef test                    # Run a cucumber-chef test suite from a
  cucumber-chef upload                  # Upload a cucumber-chef test suite from a 

Let’s quickly ...

The best content for your career. Discover unlimited learning on demand for around $1/day.