cucumber-pretty_fail_formatter 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rspec +1 -0
- data/Gemfile +5 -0
- data/LICENSE.md +22 -0
- data/README.md +61 -0
- data/Rakefile +2 -0
- data/cucumber-pretty_fail_formatter.gemspec +18 -0
- data/lib/cucumber-pretty_fail_formatter.rb +10 -0
- data/lib/cucumber/formatter/pretty_fail.rb +122 -0
- metadata +67 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: da0125008ed2a9cb031fe43767c7a4a168939107
|
4
|
+
data.tar.gz: d78a193f3c3a856adc936bec895b4ed3fa56b100
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 57a70e6f5c119acef396b2bf9395a93612b1738fe3f7dc04817dbb9029afac5ebdfd1e3204eef9f6e0f00dd1e4b8fdfeb407014d121a9ce065cd76c562b4726d
|
7
|
+
data.tar.gz: b000d2e09f86206972c5d1268160f07d1c7f2b5283eaf88644c074fcdad4c94b6b64ec94bb0e76ce12c6c5f45e833669ad78683333d444a4a99e280aed0eb671
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Copyright (c) 2015 Philipp Tessenow
|
2
|
+
|
3
|
+
```
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
```
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Pretty Fail Formatter
|
2
|
+
|
3
|
+
A cucumber formatter which is concise on success and pretty on failures. It behaves like the standard `progress` formatter, printing only nice green dots.
|
4
|
+
Except when a cuke failes, then it prints this one cuke as the standard `pretty` formatter does.
|
5
|
+
|
6
|
+
bundle exec cucumber --format pretty-fail
|
7
|
+
.....F
|
8
|
+
Feature: An Admin does something wrong
|
9
|
+
|
10
|
+
Scenario: Admin does something wrong # features/admin.feature:4
|
11
|
+
Given I want to view something as an admin # features/step_definitions/admin_steps.rb:1
|
12
|
+
When I am on the admin dashboard page # features/step_definitions/navigational_steps.rb:1
|
13
|
+
Then I should see something, which does not exist # features/step_definitions/admin_steps.rb:2
|
14
|
+
Expected something to exist
|
15
|
+
./features/step_definitions/admin_steps.rb:7:in `/^I should see (.*)$/'
|
16
|
+
features/admin.feature:10:in `Then I should see something, which does not exist'
|
17
|
+
|
18
|
+
..........
|
19
|
+
|
20
|
+
Failing Scenarios:
|
21
|
+
cucumber features/admin.feature:4 # Scenario: Admin does something wrong
|
22
|
+
|
23
|
+
3 scenarios (1 failed, 2 passed)
|
24
|
+
16 steps (1 failed, 15 passed)
|
25
|
+
0m10.307s
|
26
|
+
|
27
|
+
|
28
|
+
## Installation
|
29
|
+
|
30
|
+
Put it in your `Gemfile`
|
31
|
+
|
32
|
+
gem 'cucumber-pretty_fail_formatter'
|
33
|
+
|
34
|
+
run `bundle install`
|
35
|
+
|
36
|
+
If you don't user Bundler you can install it using the `gem` command:
|
37
|
+
|
38
|
+
$ gem install cucumber-pretty_fail_formatter
|
39
|
+
|
40
|
+
You can now run your features like this:
|
41
|
+
|
42
|
+
$ cucumber --format pretty-fail
|
43
|
+
|
44
|
+
If you want to use it as your default formatter, simply put the option in your `cucumber.yml` file:
|
45
|
+
|
46
|
+
--format pretty-fail
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
51
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
52
|
+
* Fork the project
|
53
|
+
* Start a feature/bugfix branch
|
54
|
+
* Commit and push until you are happy with your contribution
|
55
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
56
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
57
|
+
|
58
|
+
## Copyright
|
59
|
+
|
60
|
+
Copyright (c) 2015 Philipp Tessenow. This project is MIT licensed, see LICENSE.md for details.
|
61
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "cucumber-pretty_fail_formatter"
|
3
|
+
s.version = '0.0.1'
|
4
|
+
s.platform = Gem::Platform::RUBY
|
5
|
+
s.authors = ["Philipp Tessenow"]
|
6
|
+
s.email = ["philipp@tessenow.org"]
|
7
|
+
s.homepage = "https://github.com/tessi/cucumber-pretty_fail_formatter"
|
8
|
+
s.summary = %q{A cucumber formatter which is concise on success and pretty on failures}
|
9
|
+
s.description = %q{A cucumber formatter which is concise on success and pretty on failures}
|
10
|
+
s.licenses = ["MIT"]
|
11
|
+
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
|
17
|
+
s.add_dependency 'cucumber', ["~> 1.3.0"]
|
18
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'cucumber/formatter/pretty_fail'
|
2
|
+
|
3
|
+
# Extend Cucumber's builtin formats, so that this
|
4
|
+
# formatter can be used with --format pretty-fail
|
5
|
+
require 'cucumber/cli/main'
|
6
|
+
|
7
|
+
Cucumber::Cli::Options::BUILTIN_FORMATS["pretty-fail"] = [
|
8
|
+
"Cucumber::Formatter::PrettyFail",
|
9
|
+
"A cucumber formatter which is concise on success and pretty on failures"
|
10
|
+
]
|
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'cucumber'
|
2
|
+
|
3
|
+
require 'cucumber/formatter/pretty'
|
4
|
+
require 'cucumber/formatter/progress'
|
5
|
+
|
6
|
+
|
7
|
+
##
|
8
|
+
# The strategy of this formatter is to take the pretty formatter and let it write into a fake-io.
|
9
|
+
# Then do whatever the progress formatter does. but, in case of an error, print the prettyfied error from the fake-io.
|
10
|
+
module Cucumber
|
11
|
+
module Formatter
|
12
|
+
# The formatter used for <tt>--format pretty-fail</tt>
|
13
|
+
class PrettyFail < Cucumber::Formatter::Pretty
|
14
|
+
def initialize(runtime, path_or_io, options)
|
15
|
+
@runtime, @output, @options = runtime, ensure_io(path_or_io, "pretty-fail"), options
|
16
|
+
@io = StringIO.new # the fake io for the pretty formatter we inherit from
|
17
|
+
@snippets_input = []
|
18
|
+
@previous_step_keyword = nil
|
19
|
+
|
20
|
+
@exceptions = []
|
21
|
+
@indent = 0
|
22
|
+
@prefixes = options[:prefixes] || {}
|
23
|
+
@delayed_messages = []
|
24
|
+
end
|
25
|
+
|
26
|
+
def after_features(features)
|
27
|
+
@output.puts
|
28
|
+
@output.puts
|
29
|
+
print_summary(features)
|
30
|
+
end
|
31
|
+
|
32
|
+
def before_feature_element(*args)
|
33
|
+
super
|
34
|
+
@exception_raised = false
|
35
|
+
end
|
36
|
+
|
37
|
+
def after_feature_element(*args)
|
38
|
+
super
|
39
|
+
progress(:failed) if (defined? @exception_raised) and (@exception_raised)
|
40
|
+
@exception_raised = false
|
41
|
+
end
|
42
|
+
|
43
|
+
def before_steps(*args)
|
44
|
+
progress(:failed) if (defined? @exception_raised) and (@exception_raised)
|
45
|
+
@exception_raised = false
|
46
|
+
end
|
47
|
+
|
48
|
+
def after_steps(*args)
|
49
|
+
@exception_raised = false
|
50
|
+
end
|
51
|
+
|
52
|
+
def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
|
53
|
+
progress(status)
|
54
|
+
@status = status
|
55
|
+
end
|
56
|
+
|
57
|
+
def before_outline_table(outline_table)
|
58
|
+
super
|
59
|
+
@outline_table = outline_table
|
60
|
+
end
|
61
|
+
|
62
|
+
def after_outline_table(outline_table)
|
63
|
+
super
|
64
|
+
@outline_table = nil
|
65
|
+
end
|
66
|
+
|
67
|
+
def table_cell_value(value, status)
|
68
|
+
super
|
69
|
+
return unless @outline_table
|
70
|
+
status ||= @status
|
71
|
+
progress(status) unless table_header_cell?(status)
|
72
|
+
end
|
73
|
+
|
74
|
+
def exception(*args)
|
75
|
+
super
|
76
|
+
@exception_raised = true
|
77
|
+
end
|
78
|
+
|
79
|
+
private
|
80
|
+
|
81
|
+
def print_summary(features)
|
82
|
+
reset_io
|
83
|
+
print_steps(:pending)
|
84
|
+
print_steps(:failed)
|
85
|
+
print_stats(features, @options)
|
86
|
+
print_snippets(@options)
|
87
|
+
print_passing_wip(@options)
|
88
|
+
@output.print(@io.string)
|
89
|
+
@output.flush
|
90
|
+
end
|
91
|
+
|
92
|
+
CHARS = {
|
93
|
+
:passed => '.',
|
94
|
+
:failed => 'F',
|
95
|
+
:undefined => 'U',
|
96
|
+
:pending => 'P',
|
97
|
+
:skipped => '-'
|
98
|
+
}
|
99
|
+
|
100
|
+
def progress(status)
|
101
|
+
char = CHARS[status]
|
102
|
+
@output.print(format_string(char, status))
|
103
|
+
if %i(failed undefined).include?(status)
|
104
|
+
@output.puts
|
105
|
+
@output.print(@io.string)
|
106
|
+
reset_io
|
107
|
+
@output.puts
|
108
|
+
end
|
109
|
+
@output.flush
|
110
|
+
end
|
111
|
+
|
112
|
+
def table_header_cell?(status)
|
113
|
+
status == :skipped_param
|
114
|
+
end
|
115
|
+
|
116
|
+
def reset_io
|
117
|
+
@io.string = ''
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cucumber-pretty_fail_formatter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Philipp Tessenow
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cucumber
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.3.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.3.0
|
27
|
+
description: A cucumber formatter which is concise on success and pretty on failures
|
28
|
+
email:
|
29
|
+
- philipp@tessenow.org
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- .gitignore
|
35
|
+
- .rspec
|
36
|
+
- Gemfile
|
37
|
+
- LICENSE.md
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- cucumber-pretty_fail_formatter.gemspec
|
41
|
+
- lib/cucumber-pretty_fail_formatter.rb
|
42
|
+
- lib/cucumber/formatter/pretty_fail.rb
|
43
|
+
homepage: https://github.com/tessi/cucumber-pretty_fail_formatter
|
44
|
+
licenses:
|
45
|
+
- MIT
|
46
|
+
metadata: {}
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 2.0.14
|
64
|
+
signing_key:
|
65
|
+
specification_version: 4
|
66
|
+
summary: A cucumber formatter which is concise on success and pretty on failures
|
67
|
+
test_files: []
|