cucumber-formatter-oneline 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +20 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +16 -0
- data/Gemfile +2 -0
- data/LICENSE +20 -0
- data/README.md +6 -0
- data/Rakefile +6 -0
- data/cucumber-formatter-oneline.gemspec +28 -0
- data/features/dogfood/formatting.feature +22 -0
- data/features/step_definitions/dogfood.rb +31 -0
- data/features/support/env.rb +1 -0
- data/lib/cucumber/formatter/oneline.rb +167 -0
- data/lib/cucumber/formatter/oneline/version.rb +7 -0
- data/spec/oneline_spec.rb +5 -0
- data/spec/spec_helper.rb +7 -0
- metadata +155 -0
data/.gitignore
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.bundle/
|
4
|
+
/.config/
|
5
|
+
/coverage/
|
6
|
+
/InstalledFiles
|
7
|
+
/lib/bundler/man/
|
8
|
+
/pkg/
|
9
|
+
/rdoc/
|
10
|
+
/spec/reports/
|
11
|
+
/test/tmp/
|
12
|
+
/test/version_tmp/
|
13
|
+
/tmp/
|
14
|
+
|
15
|
+
# YARD artifacts
|
16
|
+
/.yardoc/
|
17
|
+
/_yardoc/
|
18
|
+
/doc/
|
19
|
+
|
20
|
+
/Gemfile.lock
|
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p194
|
data/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
language: ruby
|
3
|
+
env:
|
4
|
+
matrix:
|
5
|
+
- CUCUMBER_VERSION='~>1.3'
|
6
|
+
- CUCUMBER_VERSION='<=1.1.4'
|
7
|
+
rvm:
|
8
|
+
- ree
|
9
|
+
- '1.9'
|
10
|
+
script:
|
11
|
+
- bundle exec rake
|
12
|
+
- bundle exec cucumber -f Cucumber::Formatter::Oneline || true
|
13
|
+
notifications:
|
14
|
+
email:
|
15
|
+
recipients:
|
16
|
+
- d.buch+cucumber-formatter-oneline@modcloth.com
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 ModCloth, Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
cucumber-formatter-oneline
|
2
|
+
==========================
|
3
|
+
|
4
|
+
[![Build Status](https://travis-ci.org/modcloth-labs/cucumber-formatter-oneline.png?branch=master)](https://travis-ci.org/modcloth-labs/cucumber-formatter-oneline)
|
5
|
+
|
6
|
+
A formatter for Cucumber that uses single lines!
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cucumber/formatter/oneline/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cucumber-formatter-oneline'
|
8
|
+
spec.version = Cucumber::Formatter::Oneline::VERSION
|
9
|
+
spec.authors = ['Tim Harvey', 'Dan Buch']
|
10
|
+
spec.email = ['not-tims-email@example.org', 'd.buch@modcloth.com']
|
11
|
+
spec.description = %q{A formatter for Cucumber that uses single lines!}
|
12
|
+
spec.summary = %q{A formatter for Cucumber that uses single lines!}
|
13
|
+
spec.homepage = ''
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
# TODO get this working with cucumber>=1.3
|
22
|
+
spec.add_runtime_dependency 'cucumber', (ENV['CUCUMBER_VERSION'] || '~>1.1.4')
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~>1.3'
|
25
|
+
spec.add_development_dependency 'pry'
|
26
|
+
spec.add_development_dependency 'rake'
|
27
|
+
spec.add_development_dependency 'rspec'
|
28
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Feature:
|
2
|
+
As a developer of cucumber-formatter-oneline
|
3
|
+
I want to eat my own dogfood
|
4
|
+
So I know that it's what I say it is
|
5
|
+
|
6
|
+
Scenario: Eating our own dogfood
|
7
|
+
Given the oneline formatter is being used
|
8
|
+
When cucumber is run
|
9
|
+
Then each feature's status is reported on one line
|
10
|
+
|
11
|
+
Scenario: Exploding
|
12
|
+
Given a positive integer
|
13
|
+
When it is divided by zero
|
14
|
+
Then the explosion's backtrace should be dumped
|
15
|
+
|
16
|
+
Scenario: Undefinition
|
17
|
+
Given a step is not defined
|
18
|
+
Then it is reported as undefined
|
19
|
+
|
20
|
+
Scenario: Pending
|
21
|
+
Given a step is pending
|
22
|
+
Then it is reported as pending
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Given(/^the oneline formatter is being used$/) do
|
2
|
+
true
|
3
|
+
end
|
4
|
+
|
5
|
+
When(/^cucumber is run$/) do
|
6
|
+
true
|
7
|
+
end
|
8
|
+
|
9
|
+
Then(/^each feature's status is reported on one line$/) do
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
Given(/^a positive integer$/) do
|
14
|
+
@posint = rand(0..99)
|
15
|
+
end
|
16
|
+
|
17
|
+
When(/^it is divided by zero$/) do
|
18
|
+
@posint / 0
|
19
|
+
end
|
20
|
+
|
21
|
+
Then(/^the explosion's backtrace should be dumped$/) do
|
22
|
+
true
|
23
|
+
end
|
24
|
+
|
25
|
+
Given(/^a step is pending$/) do
|
26
|
+
pending
|
27
|
+
end
|
28
|
+
|
29
|
+
Then(/^it is reported as .*$/) do
|
30
|
+
true
|
31
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cucumber/formatter/oneline'
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# NOTE taken (and adapted) from
|
2
|
+
# http://forrst.com/posts/Cucumber_one_line_formatter-ulE
|
3
|
+
|
4
|
+
require 'time'
|
5
|
+
require 'cucumber/formatter/io'
|
6
|
+
require 'cucumber/formatter/console'
|
7
|
+
require 'cucumber/formatter/oneline/version'
|
8
|
+
|
9
|
+
module Cucumber
|
10
|
+
module Formatter
|
11
|
+
class Oneline
|
12
|
+
include Io
|
13
|
+
include Console
|
14
|
+
|
15
|
+
attr_reader :runtime, :step_mother
|
16
|
+
|
17
|
+
def initialize(runtime, path_or_io, options)
|
18
|
+
@runtime, @io, @options = runtime, ensure_io(path_or_io, 'oneline'), options
|
19
|
+
@step_mother = @runtime
|
20
|
+
@file_names = []
|
21
|
+
@step_details = []
|
22
|
+
@file_colon_lines = Hash.new{|h,k| h[k] = []}
|
23
|
+
end
|
24
|
+
|
25
|
+
def after_step_result(*step_result)
|
26
|
+
if step_result.first.respond_to?(:status)
|
27
|
+
step_result = step_result.first
|
28
|
+
keyword, step_match, = step_result.keyword, step_result.step_match
|
29
|
+
status, exception = step_result.status, step_result.exception
|
30
|
+
else
|
31
|
+
keyword, step_match, _, status, exception, _, _ = step_result
|
32
|
+
end
|
33
|
+
|
34
|
+
if status != :skipped
|
35
|
+
@step_details << "#{keyword} #{step_match.format_args('%s')}"
|
36
|
+
end
|
37
|
+
|
38
|
+
if ![:passed, :skipped, :undefined].include?(status)
|
39
|
+
@step_details << ""
|
40
|
+
@step_details << "#{exception}"
|
41
|
+
@step_details << "#{step_match.backtrace_line}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def before_feature_element(feature_element)
|
46
|
+
reset_scenario_status
|
47
|
+
end
|
48
|
+
|
49
|
+
def after_feature_element(feature_element)
|
50
|
+
# Don't print the sum result of an outline scenario
|
51
|
+
unless @scenario_outline
|
52
|
+
file, line = get_file_and_line(feature_element.file_colon_line)
|
53
|
+
progress(@scenario_status, format_file_line(file, line))
|
54
|
+
if @scenario_status != :passed && @step_details.size > 0
|
55
|
+
@io.print("\n")
|
56
|
+
@io.print(format_string(
|
57
|
+
"\n\n Scenario steps:\n", @scenario_status
|
58
|
+
))
|
59
|
+
@step_details.each do |step|
|
60
|
+
@io.print(format_string(
|
61
|
+
"\n #{step}", @scenario_status
|
62
|
+
))
|
63
|
+
end
|
64
|
+
@io.print("\n")
|
65
|
+
@io.flush
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
@scenario_outline = false
|
70
|
+
end
|
71
|
+
|
72
|
+
def step_name(keyword, step_match, status, source_indent,
|
73
|
+
background, file_colon_line = nil)
|
74
|
+
update_scenario_status(status)
|
75
|
+
end
|
76
|
+
|
77
|
+
def after_table_row(table_row)
|
78
|
+
if table_row && table_row.respond_to?(:passed?)
|
79
|
+
begin
|
80
|
+
table_row.passed?
|
81
|
+
file, line = get_file_and_line(table_row.backtrace_line)
|
82
|
+
progress(table_row.status, format_file_line(file, line))
|
83
|
+
|
84
|
+
update_scenario_status(table_row.status)
|
85
|
+
rescue Cucumber::Ast::OutlineTable::ExampleRow::InvalidForHeaderRowError
|
86
|
+
# Header row for a scenario outline
|
87
|
+
@scenario_outline = true
|
88
|
+
end
|
89
|
+
end
|
90
|
+
reset_scenario_status
|
91
|
+
end
|
92
|
+
|
93
|
+
def after_features(features)
|
94
|
+
@io.puts
|
95
|
+
@io.puts
|
96
|
+
print_summary(features)
|
97
|
+
end
|
98
|
+
|
99
|
+
private
|
100
|
+
|
101
|
+
def get_file_and_line(text)
|
102
|
+
file, line = text.split(':')
|
103
|
+
[file, line.gsub(/[^0-9]/, '')]
|
104
|
+
end
|
105
|
+
|
106
|
+
def format_file_line(file, line)
|
107
|
+
"#{file}:L##{line}"
|
108
|
+
end
|
109
|
+
|
110
|
+
def reset_scenario_status
|
111
|
+
@scenario_status = :passed
|
112
|
+
@step_details = []
|
113
|
+
end
|
114
|
+
|
115
|
+
def update_scenario_status(status)
|
116
|
+
if status == :failed
|
117
|
+
@scenario_status = status
|
118
|
+
return
|
119
|
+
end
|
120
|
+
unless [:failed, :pending, :undefined].include?(@scenario_status)
|
121
|
+
@scenario_status = status
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def progress(status, message = '')
|
126
|
+
@io.print(
|
127
|
+
format_string(
|
128
|
+
"\n[#{Time.now.rfc822}] #{STATUS_MESSAGES[status]} #{message}", status
|
129
|
+
)
|
130
|
+
)
|
131
|
+
@io.flush
|
132
|
+
end
|
133
|
+
|
134
|
+
STATUS_MESSAGES = {
|
135
|
+
:passed => ' Pass ',
|
136
|
+
:failed => '**** FAIL ****',
|
137
|
+
:undefined => '**** Undefined',
|
138
|
+
:pending => '**** Pending ',
|
139
|
+
:skipped => ' Skipped '
|
140
|
+
}
|
141
|
+
|
142
|
+
def print_summary(features)
|
143
|
+
print_steps(:pending)
|
144
|
+
print_steps(:failed)
|
145
|
+
print_stats(features, @options)
|
146
|
+
print_snippets(@options)
|
147
|
+
print_passing_wip(@options)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
=begin
|
154
|
+
require 'cucumber/cli/options'
|
155
|
+
|
156
|
+
module Cucumber
|
157
|
+
module Cli
|
158
|
+
class Options
|
159
|
+
if defined?(BUILTIN_FORMATS)
|
160
|
+
BUILTIN_FORMATS['oneline'] = [
|
161
|
+
'Cucumber::Formatter::Oneline', 'Prints one line per feature'
|
162
|
+
]
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
=end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cucumber-formatter-oneline
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tim Harvey
|
9
|
+
- Dan Buch
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2013-11-18 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: cucumber
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.1.4
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 1.1.4
|
31
|
+
- !ruby/object:Gem::Dependency
|
32
|
+
name: bundler
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ~>
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '1.3'
|
39
|
+
type: :development
|
40
|
+
prerelease: false
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.3'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: pry
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: rake
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
name: rspec
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
83
|
+
requirements:
|
84
|
+
- - ! '>='
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
type: :development
|
88
|
+
prerelease: false
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
description: A formatter for Cucumber that uses single lines!
|
96
|
+
email:
|
97
|
+
- not-tims-email@example.org
|
98
|
+
- d.buch@modcloth.com
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- .gitignore
|
104
|
+
- .rspec
|
105
|
+
- .ruby-version
|
106
|
+
- .travis.yml
|
107
|
+
- Gemfile
|
108
|
+
- LICENSE
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- cucumber-formatter-oneline.gemspec
|
112
|
+
- features/dogfood/formatting.feature
|
113
|
+
- features/step_definitions/dogfood.rb
|
114
|
+
- features/support/env.rb
|
115
|
+
- lib/cucumber/formatter/oneline.rb
|
116
|
+
- lib/cucumber/formatter/oneline/version.rb
|
117
|
+
- spec/oneline_spec.rb
|
118
|
+
- spec/spec_helper.rb
|
119
|
+
homepage: ''
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
segments:
|
133
|
+
- 0
|
134
|
+
hash: -572312240300309257
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
none: false
|
137
|
+
requirements:
|
138
|
+
- - ! '>='
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
segments:
|
142
|
+
- 0
|
143
|
+
hash: -572312240300309257
|
144
|
+
requirements: []
|
145
|
+
rubyforge_project:
|
146
|
+
rubygems_version: 1.8.23
|
147
|
+
signing_key:
|
148
|
+
specification_version: 3
|
149
|
+
summary: A formatter for Cucumber that uses single lines!
|
150
|
+
test_files:
|
151
|
+
- features/dogfood/formatting.feature
|
152
|
+
- features/step_definitions/dogfood.rb
|
153
|
+
- features/support/env.rb
|
154
|
+
- spec/oneline_spec.rb
|
155
|
+
- spec/spec_helper.rb
|