README.md in auxesis-cucumber-nagios-0.3.1 vs README.md in auxesis-cucumber-nagios-0.3.4

- old
+ new

@@ -11,10 +11,22 @@ Transform from a grumpy, misanthropic sysadmin to a hipster, agile developer instantly.” +Quickstart +========== + + 0. gem sources -a http://gems.github.com + 1. gem install auxesis-cucumber-nagios + 2. cucumber-nagios-gen project bunch-o-tests + 3. cd bunch-o-tests + 4. rake deps + 5. bin/cucumber-nagios-gen feature ebay.com.au bidding + 6. bin/cucumber-nagios features/ebay.com.au/bidding.feature + + Setting up a project ==================== To set up a standalone `cucumber-nagios` project, run: @@ -24,16 +36,45 @@ Check the `README` within this directory for specific instructions for managing the project. -Writing Features +Freezing +======== + +Freezing your dependencies into your project allows you to drop your +`cucumber-nagios` project to any machine and have it run. Its only requirement is +Ruby and Rake. + +To freeze your project, within your project directory run: + + $ rake deps + +Redeploying +=========== + +Once you've copied your project around, Just run the freezer again: + + $ rake deps + +Writing features ================ -Within your project, I suggest you put your features under under `features/$fqdn/$name.feature`. +Once you've set up a project, you can use the `bin/cucumber-nagios-gen` command +to generate new features. It takes two arguments: the site you're testing, and +feature you're testing: -You'll want to have a read of the Cucumber documentation, however + bin/cucumber-nagios-gen feature gnome.org navigation + +This will spit out two files: + + features/gnome.org/navigation.feature + features/gnome.org/steps/navigation_steps.rb + + +As for writing features, you'll want to have a read of the +[Cucumber documentation](http://wiki.github.com/aslakhellesoy/cucumber), however your tests will look something like this: Feature: google.com.au It should be up And I should be able to search for things @@ -75,10 +116,11 @@ bin/cucumber --require bin/common.rb \ --require features/ features/smh/smh.feature +This will output using the default 'pretty' formatter. Running ======= Invoke the Cucumber feature with the `cucumber-nagios` script: @@ -98,19 +140,50 @@ The value printed at the end is in Nagios's Performance Data format, so it can be graphed and the like. -Caveats -======= +Quirks & Caveats +================ +Multiple scenarios +------------------ + You may want to think about keeping to one scenario to a file, otherwise you'll get multiple lines of output for a test: Critical: 1, Warning: 0, 2 okay | passed=2, failed=1, total=3 Critical: 1, Warning: 0, 4 okay | passed=4, failed=1, total=5 That said, Nagios should only read the last line, so this might be an ok behaviour when you want to test for an aggregate of failures across a site. +Failure *is* an option (exceptions are good) +-------------------------------------------- +Exceptions raised within your tests will appear in the failed totals, so you +don't need to worry about trying to catch them in your own custom steps. +i.e. if you try fetching a page on a server that is down, or the page returns +a 404, the exception raised by Mechanize just gets treated by Cucumber as a +test failure. + + +Version control +=============== + +I highly recommend storing your cucumber-nagios projects in a version control +system! + +To get up and running with git: + + $ git init + $ git add . + $ git commit -m 'created cucumber-nagios project' + +To get up and running with bzr: + + $ bzr init + $ bzr add + $ bzr commit -m 'created cucumber-nagios project' + +.bzrignore and .gitignores are created when you generate a project.