Skip to content

Commit

Permalink
Docs updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
iafonov committed Mar 28, 2012
1 parent f217ab9 commit 8291732
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
23 changes: 19 additions & 4 deletions README.md
Expand Up @@ -6,8 +6,6 @@ This chef cookbook provides dead simple way to test and verify node's setup afte

It could be used as a tool to support BDD style in development of your infrastructure and as a regression testing tool.

You can find some background and more detailed information [here](http://iafonov.github.com/blog/pragmatic-infrastructure-testing-with-cucumber.html).

Requirements
============
Cookbook depends on Opscode's [chef_handler](http://community.opscode.com/cookbooks/chef_handler) cookbook. (Run `knife cookbook site install chef_handler` to install it)
Expand All @@ -17,6 +15,7 @@ There are no additional limitations on environment. You can use it with any kind
Attributes
==========
* `node["simple_cuke"]["suite_path"]` - Location for the test suite on the target node (`/var/chef/handlers/suite` by default)
* `node["simple_cuke"]["reporter"]` - Reporter which would be used to notify you results of tests.

Usage
=====
Expand Down Expand Up @@ -82,6 +81,24 @@ Scenario Outline: Service should not be blocked by firewall
| Apache | ALLOW |
| Postfix | ALLOW |
```

Reporters
=========

By default reporting is done to console but you can override this behavior and add custom reporter to `files/default/reporters` folder. Reporter is a plain ruby class with the following skeleton:

class CustomReporter
def success(report)
end

def fail(report)
end
end

You can set reporter via `node["simple_cuke"]["reporter"]` attribute. (If your class has name `CustomReporter` you should set this attribute value to `custom`)

For example you can send an email if test suite failed, write it to file or notify monitoring service.

<a name="details"></a>
How it works (in details)
=========================
Expand All @@ -91,6 +108,4 @@ The idea behind implementation is to be as simple and straightforward as possibl
2. [Chef handler](http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers) is registered.
3. When handler is executed it installs the bundle (it consists of cucumber & aruba) and runs cucumber features.

For now reporting is done only to console.

© 2012 [Igor Afonov](http://iafonov.github.com)
1 change: 1 addition & 0 deletions attributes/default.rb
@@ -1 +1,2 @@
default["simple_cuke"]["reporter"] = :console
default["simple_cuke"]["suite_path"] = "#{File.expand_path(File.join(Chef::Config[:file_cache_path],'..'))}/suite"
2 changes: 1 addition & 1 deletion recipes/default.rb
Expand Up @@ -13,7 +13,7 @@
:reporters_path => reporters_path,
:node_roles => node.roles,
:all_roles => search(:role, "name:*").map{ |role| role.name },
:reporter => :console
:reporter => node["simple_cuke"]["reporter"]
end

remote_directory reporters_path do
Expand Down

0 comments on commit 8291732

Please sign in to comment.