auxesis-cucumber-nagios 0.3.1 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -13,6 +13,18 @@ As Bradley Taylor [put it](http://bradley.is/post/82649218/testing-dash-metrics-
|
|
13
13
|
agile developer instantly.”
|
14
14
|
|
15
15
|
|
16
|
+
Quickstart
|
17
|
+
==========
|
18
|
+
|
19
|
+
0. gem sources -a http://gems.github.com
|
20
|
+
1. gem install auxesis-cucumber-nagios
|
21
|
+
2. cucumber-nagios-gen project bunch-o-tests
|
22
|
+
3. cd bunch-o-tests
|
23
|
+
4. rake deps
|
24
|
+
5. bin/cucumber-nagios-gen feature ebay.com.au bidding
|
25
|
+
6. bin/cucumber-nagios features/ebay.com.au/bidding.feature
|
26
|
+
|
27
|
+
|
16
28
|
Setting up a project
|
17
29
|
====================
|
18
30
|
|
@@ -26,12 +38,41 @@ Check the `README` within this directory for specific instructions for managing
|
|
26
38
|
the project.
|
27
39
|
|
28
40
|
|
29
|
-
|
41
|
+
Freezing
|
42
|
+
========
|
43
|
+
|
44
|
+
Freezing your dependencies into your project allows you to drop your
|
45
|
+
`cucumber-nagios` project to any machine and have it run. Its only requirement is
|
46
|
+
Ruby and Rake.
|
47
|
+
|
48
|
+
To freeze your project, within your project directory run:
|
49
|
+
|
50
|
+
$ rake deps
|
51
|
+
|
52
|
+
Redeploying
|
53
|
+
===========
|
54
|
+
|
55
|
+
Once you've copied your project around, Just run the freezer again:
|
56
|
+
|
57
|
+
$ rake deps
|
58
|
+
|
59
|
+
Writing features
|
30
60
|
================
|
31
61
|
|
32
|
-
|
62
|
+
Once you've set up a project, you can use the `bin/cucumber-nagios-gen` command
|
63
|
+
to generate new features. It takes two arguments: the site you're testing, and
|
64
|
+
feature you're testing:
|
65
|
+
|
66
|
+
bin/cucumber-nagios-gen feature gnome.org navigation
|
67
|
+
|
68
|
+
This will spit out two files:
|
69
|
+
|
70
|
+
features/gnome.org/navigation.feature
|
71
|
+
features/gnome.org/steps/navigation_steps.rb
|
33
72
|
|
34
|
-
|
73
|
+
|
74
|
+
As for writing features, you'll want to have a read of the
|
75
|
+
[Cucumber documentation](http://wiki.github.com/aslakhellesoy/cucumber), however
|
35
76
|
your tests will look something like this:
|
36
77
|
|
37
78
|
Feature: google.com.au
|
@@ -77,6 +118,7 @@ writing your tests:
|
|
77
118
|
--require features/
|
78
119
|
features/smh/smh.feature
|
79
120
|
|
121
|
+
This will output using the default 'pretty' formatter.
|
80
122
|
|
81
123
|
Running
|
82
124
|
=======
|
@@ -100,8 +142,11 @@ The value printed at the end is in Nagios's Performance Data format, so it
|
|
100
142
|
can be graphed and the like.
|
101
143
|
|
102
144
|
|
103
|
-
Caveats
|
104
|
-
|
145
|
+
Quirks & Caveats
|
146
|
+
================
|
147
|
+
|
148
|
+
Multiple scenarios
|
149
|
+
------------------
|
105
150
|
|
106
151
|
You may want to think about keeping to one scenario to a file, otherwise
|
107
152
|
you'll get multiple lines of output for a test:
|
@@ -112,5 +157,33 @@ you'll get multiple lines of output for a test:
|
|
112
157
|
That said, Nagios should only read the last line, so this might be an ok
|
113
158
|
behaviour when you want to test for an aggregate of failures across a site.
|
114
159
|
|
160
|
+
Failure *is* an option (exceptions are good)
|
161
|
+
--------------------------------------------
|
162
|
+
|
163
|
+
Exceptions raised within your tests will appear in the failed totals, so you
|
164
|
+
don't need to worry about trying to catch them in your own custom steps.
|
165
|
+
|
166
|
+
i.e. if you try fetching a page on a server that is down, or the page returns
|
167
|
+
a 404, the exception raised by Mechanize just gets treated by Cucumber as a
|
168
|
+
test failure.
|
169
|
+
|
170
|
+
|
171
|
+
Version control
|
172
|
+
===============
|
173
|
+
|
174
|
+
I highly recommend storing your cucumber-nagios projects in a version control
|
175
|
+
system!
|
176
|
+
|
177
|
+
To get up and running with git:
|
178
|
+
|
179
|
+
$ git init
|
180
|
+
$ git add .
|
181
|
+
$ git commit -m 'created cucumber-nagios project'
|
182
|
+
|
183
|
+
To get up and running with bzr:
|
115
184
|
|
185
|
+
$ bzr init
|
186
|
+
$ bzr add
|
187
|
+
$ bzr commit -m 'created cucumber-nagios project'
|
116
188
|
|
189
|
+
.bzrignore and .gitignores are created when you generate a project.
|
@@ -23,12 +23,21 @@ Just run the freezer again:
|
|
23
23
|
|
24
24
|
$ rake deps
|
25
25
|
|
26
|
+
Writing features
|
27
|
+
================
|
28
|
+
|
29
|
+
Once you've set up a project, you can use the bin/cucumber-nagios-gen command
|
30
|
+
to generate new features. It takes two arguments: the site you're testing, and
|
31
|
+
feature you're testing:
|
32
|
+
|
33
|
+
bin/cucumber-nagios-gen feature gnome.org navigation
|
34
|
+
|
26
35
|
|
27
36
|
Version control
|
28
37
|
===============
|
29
38
|
|
30
39
|
I highly recommend storing your cucumber-nagios features in a version control
|
31
|
-
system
|
40
|
+
system!
|
32
41
|
|
33
42
|
To get up and running with git:
|
34
43
|
|
@@ -24,6 +24,8 @@ task :deps do
|
|
24
24
|
'mechanize' => ">= 0.9.1",
|
25
25
|
'rspec' => ">= 1.1.12"}
|
26
26
|
|
27
|
+
puts "\ninstalling dependencies. this will take a few minutes."
|
28
|
+
|
27
29
|
deps.each_pair do |dep, version|
|
28
30
|
puts "\ninstalling #{dep} (#{version})"
|
29
31
|
system("gem install #{dep} --version '#{version}' -i gems --no-rdoc --no-ri")
|
@@ -11,9 +11,9 @@ Then /^I should see an? (\w+) message$/ do |message_type|
|
|
11
11
|
end
|
12
12
|
|
13
13
|
Then /^the (.*) ?request should succeed/ do |_|
|
14
|
-
|
14
|
+
success_code?.should be_true
|
15
15
|
end
|
16
16
|
|
17
17
|
Then /^the (.*) ?request should fail/ do |_|
|
18
|
-
|
18
|
+
success_code?.should be_false
|
19
19
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auxesis-cucumber-nagios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lindsay Holmwood
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-06 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|