The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com
Before writing your first feature, you have to setup the infrastructure in your Puppet directory. Assuming you develop your Puppet manifests in ~/puppet/.
$ 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.
@confdir Puppet's confdir defaults to /etc/puppet @manifest full path to the manifest to use defaults to @confdir + /manifests/site.pp facts this is a hash of facter facts defaults to 'architecture' => '' 'domain' => 'no.domain' 'environment' => 'production' 'hostname' => 'testnode' 'lsbdistcodename' => '' 'network_eth0' => '127.0.0.0' 'operatingsystem' => ''
cucumber-puppet assumes you have your Puppet manifests organized in modules and
does the same with your feature files. Depending on your current working
cucumber-puppet-gen will create new features either in ~puppet/features/modules/foo/ (this is the default) or in ~puppet/modules/foo/features/ (in case your current working directory is somewhere inside ~/puppet/modules/.
$ 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/.
To logically seperate step definitions, the following naming scheme is suggested
.rbfor type specific steps, for example user.rb
.rbfor module specific steps, for example module_foo.rb
.rbfor define specific steps, for example define_bar.rb
The names don’t have any special meaning to cucumber, it finds all .rb files, placed in the proper directory.
To run above feature, execute
$ cucumber-puppet features/modules/foo/bar.feature
and see it complain about missing step definitions. Add these as necessary to your step files and make your feature green.
For more information about writing cucumber features, see cucumber tutorials.
Source code is available at github.