autotest-cucumber-notification 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +4 -0
- data/LICENSE.rdoc +23 -0
- data/README.md +63 -0
- data/README.rdoc +36 -0
- data/Rakefile +8 -0
- data/autotest-cucumber-notification.gemspec +33 -0
- data/images/fail.png +0 -0
- data/images/pass.png +0 -0
- data/images/pending.png +0 -0
- data/images/undefined.png +0 -0
- data/lib/autotest-cucumber-notification.rb +2 -0
- data/lib/autotest-cucumber-notification/autotest-cucumber-notification.rb +94 -0
- data/lib/autotest-cucumber-notification/version.rb +4 -0
- metadata +100 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.rdoc
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
== The MIT License
|
2
|
+
|
3
|
+
* Code: Copyright (c) Curt Hasselschwert, Matt Buck, 2008
|
4
|
+
* Gem: Copyright (c) Pavel Argentov, 2012
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
'Software'), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
20
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
21
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
22
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
23
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# Cucumber notifier for autotest
|
2
|
+
|
3
|
+
This is a module for autotest that will provide notification for the results
|
4
|
+
of your Cucumber features.
|
5
|
+
|
6
|
+
## Requirements
|
7
|
+
|
8
|
+
1. Autotest (ZenTest) configured to run your Cucumber features.
|
9
|
+
2. libnotify --- This module only works on linux with the libnotify package
|
10
|
+
right now. I'll work on adding support for other notification frameworks in
|
11
|
+
the future.
|
12
|
+
|
13
|
+
## Using the gem
|
14
|
+
|
15
|
+
1. Install the gem:
|
16
|
+
|
17
|
+
$ gem install autotest-cucumber-notification
|
18
|
+
|
19
|
+
2. Edit your `.autotest` to include the module. If you downloaded it to your
|
20
|
+
home folder, do something like this:
|
21
|
+
|
22
|
+
require 'rubygems' # for ruby versions prior to 1.9
|
23
|
+
require 'cucumber-notify'
|
24
|
+
|
25
|
+
3. That's it. Just run Autotest with your Cucumber features like normal.
|
26
|
+
|
27
|
+
## Credits
|
28
|
+
|
29
|
+
The original code was written by Curt Hasselschwert and re-combined later by Matt Buck.
|
30
|
+
The code is largely based on the work done by [carlosbrando](https://github.com/carlosbrando),
|
31
|
+
and his work on [the autotest-notification gem](https://github.com/carlosbrando/autotest-notification),
|
32
|
+
many thanks to him.
|
33
|
+
|
34
|
+
The cool icons came from the [Buuf icon set](http://mattahan.deviantart.com/art/Buuf-37966044)
|
35
|
+
by [Paul Davey](http://mattahan.deviantart.com/).
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
```
|
40
|
+
The MIT License
|
41
|
+
|
42
|
+
* Code: Copyright (c) Curt Hasselschwert, Matt Buck, 2008
|
43
|
+
* Gem: Copyright (c) Pavel Argentov, 2012
|
44
|
+
|
45
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
46
|
+
a copy of this software and associated documentation files (the
|
47
|
+
'Software'), to deal in the Software without restriction, including
|
48
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
49
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
50
|
+
permit persons to whom the Software is furnished to do so, subject to
|
51
|
+
the following conditions:
|
52
|
+
|
53
|
+
The above copyright notice and this permission notice shall be
|
54
|
+
included in all copies or substantial portions of the Software.
|
55
|
+
|
56
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
57
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
58
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
59
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
60
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
61
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
62
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
63
|
+
```
|
data/README.rdoc
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
= Cucumber notifier for autotest
|
2
|
+
|
3
|
+
This is a module for autotest that will provide notification for the results of your Cucumber features.
|
4
|
+
|
5
|
+
== Requirements
|
6
|
+
|
7
|
+
1. Autotest (ZenTest) configured to run your Cucumber features
|
8
|
+
2. libnotify -- This module only works on linux with the libnotify package
|
9
|
+
right now. I'll work on adding support for other notification frameworks in
|
10
|
+
the future
|
11
|
+
|
12
|
+
== Using the gem
|
13
|
+
|
14
|
+
1. Install the gem:
|
15
|
+
|
16
|
+
$ gem install autotest-cucumber-notification
|
17
|
+
|
18
|
+
2. Edit your .autotest to include the module. If you downloaded it to your
|
19
|
+
home folder, do something like this:
|
20
|
+
|
21
|
+
require 'rubygems'
|
22
|
+
require 'autotest-cucumber-notification'
|
23
|
+
|
24
|
+
3. That's it. Just run Autotest with your Cucumber features like normal.
|
25
|
+
|
26
|
+
== Credits
|
27
|
+
|
28
|
+
The original code was written by Curt Hasselschwert and re-combined later by Matt Buck.
|
29
|
+
The code is largely based on the work done by carlosbrando[https://github.com/carlosbrando],
|
30
|
+
and his work on the (autotest-notification gem
|
31
|
+
(https://github.com/carlosbrando/autotest-notification),
|
32
|
+
many thanks to him.
|
33
|
+
|
34
|
+
The cool icons came from the Buuf icon set (http://mattahan.deviantart.com/art/Buuf-37966044)
|
35
|
+
by Paul Davey (http://mattahan.deviantart.com/).
|
36
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.unshift File.expand_path("lib", File.dirname(__FILE__))
|
3
|
+
require "autotest-cucumber-notification/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "autotest-cucumber-notification"
|
7
|
+
s.version = AutotestCucumberNotification::VERSION
|
8
|
+
s.authors = ["Pavel Argentov"]
|
9
|
+
s.email = ["argentoff@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/argent-smith/autotest-cucumber-notification"
|
11
|
+
s.summary = %q{Libnotify notification poster for cucumber run under autotest.}
|
12
|
+
s.description = %q{This is an autotest plugin that will notify you about the results of your Cucumber features run.}
|
13
|
+
|
14
|
+
s.extra_rdoc_files = [
|
15
|
+
"LICENSE.rdoc",
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
|
19
|
+
s.rdoc_options = [
|
20
|
+
'--title', 'Cucumber notifier for autotest',
|
21
|
+
'--main', 'README.rdoc'
|
22
|
+
]
|
23
|
+
|
24
|
+
s.files = `git ls-files`.split("\n")
|
25
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
26
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
27
|
+
s.require_paths = ["lib"]
|
28
|
+
|
29
|
+
# specify any dependencies here; for example:
|
30
|
+
s.add_development_dependency "gemcutter"
|
31
|
+
s.add_runtime_dependency "cucumber"
|
32
|
+
s.add_runtime_dependency "ZenTest"
|
33
|
+
end
|
data/images/fail.png
ADDED
Binary file
|
data/images/pass.png
ADDED
Binary file
|
data/images/pending.png
ADDED
Binary file
|
Binary file
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# Usage:: see README
|
2
|
+
module AutotestCucumberNotification
|
3
|
+
|
4
|
+
# Notifier configuration helpers and defaults.
|
5
|
+
class Config
|
6
|
+
|
7
|
+
class << self
|
8
|
+
attr_reader :images_directory
|
9
|
+
attr_accessor :success_image, :fail_image, :pending_image, :undefined_image, :expiration_in_seconds,
|
10
|
+
:failure, :success, :pending, :undefined, :fade_timeout
|
11
|
+
|
12
|
+
def images_directory=(path)
|
13
|
+
@images_directory = File.expand_path(path)
|
14
|
+
@success_image = "#{@images_directory}/pass.png"
|
15
|
+
@fail_image = "#{@images_directory}/fail.png"
|
16
|
+
@pending_image = "#{@images_directory}/pending.png"
|
17
|
+
@undefined_image = "#{@images_directory}/undefined.png"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
self.images_directory = File.expand_path('../../images', File.dirname(__FILE__))
|
22
|
+
self.fade_timeout = 5000
|
23
|
+
self.failure = "Features Failure"
|
24
|
+
self.success = "Features Success"
|
25
|
+
self.pending = "Features Pending"
|
26
|
+
self.undefined = "Features Undefined"
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
Autotest.add_hook :ran_features do |at|
|
31
|
+
result = at.results.is_a?(String) ? at.results : at.results.to_s
|
32
|
+
|
33
|
+
if result
|
34
|
+
@scenarios = result[/(\d+) scenarios?/,1].to_i
|
35
|
+
@steps = result[/(\d+) steps?/,1].to_i
|
36
|
+
@scenario_stats = Hash.new
|
37
|
+
@step_stats = Hash.new
|
38
|
+
|
39
|
+
%w{ failed skipped passed pending undefined }.each do |x|
|
40
|
+
@scenario_stats.merge!({ "#{x}" => result[/\d+ scenarios?.*?(\d+) #{x}.*\)/,1].to_i })
|
41
|
+
@step_stats.merge!({ "#{x}" => result[/\d+ steps?.*?(\d+) #{x}.*\)/,1].to_i })
|
42
|
+
end
|
43
|
+
|
44
|
+
if @scenario_stats["failed"] > 0 || @step_stats["failed"] > 0
|
45
|
+
notify Config.failure, assemble_msg(@scenarios,@steps,@scenario_stats,@step_stats), Config.fail_image
|
46
|
+
elsif @scenario_stats["pending"] > 0 || @step_stats["pending"] > 0
|
47
|
+
notify Config.pending, assemble_msg(@scenarios,@steps,@scenario_stats,@step_stats), Config.pending_image
|
48
|
+
elsif @scenario_stats["undefined"] > 0 || @step_stats["undefined"] > 0
|
49
|
+
notify Config.undefined, assemble_msg(@scenarios,@steps,@scenario_stats,@step_stats), Config.undefined_image
|
50
|
+
elsif @scenario_stats["passed"] > 0 && @step_stats["passed"] > 0
|
51
|
+
notify Config.success, assemble_msg(@scenarios,@steps,@scenario_stats,@step_stats), Config.success_image
|
52
|
+
else
|
53
|
+
notify Config.failure, "Errors Ecountered", Config.fail_image
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class << self
|
59
|
+
|
60
|
+
def notify(title, msg, img = Config.success_image)
|
61
|
+
system "notify-send -i #{img} '#{title}' '#{msg}' -t #{Config.fade_timeout}"
|
62
|
+
end
|
63
|
+
|
64
|
+
def pluralize(text, number)
|
65
|
+
"#{number} #{text}#{'s' if number != 1}"
|
66
|
+
end
|
67
|
+
|
68
|
+
def assemble_msg(scenarios, steps, scenario_stats = {}, step_stats = {})
|
69
|
+
msg = ""
|
70
|
+
if scenarios > 0
|
71
|
+
msg += "#{pluralize('scenario',scenarios)}"
|
72
|
+
msg += "\n#{stat_string(scenario_stats)}"
|
73
|
+
msg += "\n\n" if steps > 0
|
74
|
+
end
|
75
|
+
if steps > 0
|
76
|
+
msg += "#{pluralize('step',steps)}"
|
77
|
+
msg += "\n#{stat_string(step_stats)}"
|
78
|
+
end
|
79
|
+
return msg
|
80
|
+
end
|
81
|
+
|
82
|
+
def stat_string(hash)
|
83
|
+
stat_str = "("
|
84
|
+
hash.each do |key,value|
|
85
|
+
if value > 0
|
86
|
+
stat_str += "#{value} #{key},"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
stat_str += ")"
|
90
|
+
stat_str.gsub!(",\)",")")
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: autotest-cucumber-notification
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Pavel Argentov
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: gemcutter
|
16
|
+
requirement: &342011000 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *342011000
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: cucumber
|
27
|
+
requirement: &342010780 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *342010780
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: ZenTest
|
38
|
+
requirement: &342010570 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *342010570
|
47
|
+
description: This is an autotest plugin that will notify you about the results of
|
48
|
+
your Cucumber features run.
|
49
|
+
email:
|
50
|
+
- argentoff@gmail.com
|
51
|
+
executables: []
|
52
|
+
extensions: []
|
53
|
+
extra_rdoc_files:
|
54
|
+
- LICENSE.rdoc
|
55
|
+
- README.rdoc
|
56
|
+
files:
|
57
|
+
- .gitignore
|
58
|
+
- Gemfile
|
59
|
+
- LICENSE.rdoc
|
60
|
+
- README.md
|
61
|
+
- README.rdoc
|
62
|
+
- Rakefile
|
63
|
+
- autotest-cucumber-notification.gemspec
|
64
|
+
- images/fail.png
|
65
|
+
- images/pass.png
|
66
|
+
- images/pending.png
|
67
|
+
- images/undefined.png
|
68
|
+
- lib/autotest-cucumber-notification.rb
|
69
|
+
- lib/autotest-cucumber-notification/autotest-cucumber-notification.rb
|
70
|
+
- lib/autotest-cucumber-notification/version.rb
|
71
|
+
homepage: https://github.com/argent-smith/autotest-cucumber-notification
|
72
|
+
licenses: []
|
73
|
+
post_install_message:
|
74
|
+
rdoc_options:
|
75
|
+
- --title
|
76
|
+
- Cucumber notifier for autotest
|
77
|
+
- --main
|
78
|
+
- README.rdoc
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 1.8.15
|
96
|
+
signing_key:
|
97
|
+
specification_version: 3
|
98
|
+
summary: Libnotify notification poster for cucumber run under autotest.
|
99
|
+
test_files: []
|
100
|
+
has_rdoc:
|