Skip to content

cucumber-puppet 0.0.3 released

I am happy to announce the release of cucumber-puppet 0.0.3. cucumber-puppet is the glue between cucumber and Puppet, allowing you to write behavioural tests, or features as cucumber calls it, for your Puppet manifest. You can find introductiary material to cucumber here.

cucumber-puppet is currently in alpha-testing.

Installation

cucumber-puppet comes packaged as a gem

$ gem install cucumber-puppet

or can be cloned from github

$ git clone http://github.com/nistude/cucumber-puppet.git

Usage

Initial setup

Before writing your first feature, you have to setup the infrastructure in your Puppet directory.

$ cd puppet
$ cucumber-puppet-gen world

This installs some example step definitions for cucumber to ./features/steps/ and ensures the cucumber-puppet glue code is available. You can adapt cucumber-puppet to your needs in ./features/support/hooks.rb.

Writing features

cucumber-puppet assumes you have your Puppet manifest organized in modules and does the same with your feature files.

$ cucumber-puppet-gen feature foo bar

generates ./features/modules/foo/bar.feature from the standard template. Use this file to write your feature and add missing step definitions to files in ./features/steps/.

A feature might look like this:

Feature: cucumber-puppet
  In order to run my puppet manifest's test suite
  As an admin
  I want the cucumber-puppet gem installed

  Scenario: Install cucumber-puppet
    Given a node of class "cucumber-puppet"
    When I compile the catalog
    Then gem "cucumber-puppet" should be "installed"

Running features

To run above feature, execute

$ cucumber-puppet features/modules/foo/bar.feature

and see it complain about missing step definitions. Add these to .rb files in ./features/steps/.

If you have any questions or feedback, feel free to leave a comment or email me at cucumber-puppet at erisiandiscord.de.

Comments On This Entry

  1. James Turnbull

    Have I misunderstood? Shouldn't this line:

        Then gem "cucumber-puppet" should be "installed"
    

    be:

        Then package "cucumber-puppet" should be "installed"
    

    Or am I mistaken?

  2. Nikolay Sturm

    Both are correct, depending on your viewpoint.

    The first case would probably expand to two steps, a test for a matching package resource and a test on the provider being gem.

    The second case would probably just test for the resource.

    The question is, which one makes more sense? Which one is on a sensible layer of abstraction? The answer might very well depend on your local setup.

  3. Tim Stoop

    This is awesome! I knew I should've been looking into cucumber some more :) Looking forward to the development and maybe some tutorials ;-)

  4. Stas

    Any idea for installation on CentOS 5.4?

    I'm just getting the following error:

    WARNING: #<ArgumentError: Illformed requirement [">= 0.7.0.beta.8"]>

  5. Nikolay Sturm

    I have no idea, but cucumber-puppet does not depend on anything with such a version number.