cuporter 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +123 -44
- data/Rakefile +5 -5
- data/bin/cuporter +19 -11
- data/lib/cuporter.rb +15 -26
- data/lib/cuporter/cli/options.rb +95 -22
- data/lib/cuporter/document.rb +23 -0
- data/lib/cuporter/document/html_document.rb +82 -0
- data/lib/cuporter/extensions/nokogiri.rb +46 -0
- data/lib/cuporter/feature_parser.rb +38 -19
- data/lib/cuporter/filter.rb +1 -0
- data/lib/cuporter/formatters/csv.rb +69 -0
- data/lib/cuporter/formatters/text.rb +166 -0
- data/lib/cuporter/formatters/xml_to_html.xslt +315 -0
- data/lib/cuporter/node.rb +7 -83
- data/lib/cuporter/node/node_base.rb +114 -0
- data/lib/cuporter/node/numbering.rb +32 -0
- data/lib/cuporter/node/sorting.rb +27 -0
- data/lib/cuporter/node/tagged_node.rb +22 -0
- data/lib/cuporter/node/totalling.rb +19 -0
- data/lib/cuporter/node/types.rb +158 -0
- data/lib/cuporter/node_parser.rb +62 -0
- data/lib/cuporter/report/feature_report.rb +23 -0
- data/lib/cuporter/report/report_base.rb +69 -0
- data/lib/cuporter/report/tag_report.rb +27 -7
- data/lib/cuporter/report/tree_report.rb +24 -0
- data/lib/cuporter/tag_nodes_parser.rb +94 -0
- data/public/images/ajax-loader.gif +0 -0
- data/public/images/file.gif +0 -0
- data/public/images/folder-closed.gif +0 -0
- data/public/images/folder.gif +0 -0
- data/public/images/minus.gif +0 -0
- data/public/images/plus.gif +0 -0
- data/public/images/treeview-black-line.gif +0 -0
- data/public/images/treeview-black.gif +0 -0
- data/public/images/treeview-default-line.gif +0 -0
- data/public/images/treeview-default.gif +0 -0
- data/public/images/treeview-famfamfam-line.gif +0 -0
- data/public/images/treeview-famfamfam.gif +0 -0
- data/public/images/treeview-gray-line.gif +0 -0
- data/public/images/treeview-gray.gif +0 -0
- data/public/images/treeview-red-line.gif +0 -0
- data/public/images/treeview-red.gif +0 -0
- data/public/javascripts/expand-collapse.js +47 -0
- data/public/javascripts/jquery-min.js +167 -0
- data/public/javascripts/jquery.treeview.js +267 -0
- data/public/javascripts/treeview-loader.js +11 -0
- data/public/stylesheets/cuporter.css +101 -0
- data/{lib/cuporter/formatter/name_report/style.css → public/stylesheets/feature_style.css} +17 -18
- data/public/stylesheets/jquery.treeview.css +75 -0
- data/{lib/cuporter/formatter/tag_report/style.css → public/stylesheets/tag_style.css} +17 -22
- data/public/stylesheets/tree_style.css +104 -0
- metadata +52 -37
- data/lib/cuporter/example_set_node.rb +0 -15
- data/lib/cuporter/formatter/csv_text_methods.rb +0 -20
- data/lib/cuporter/formatter/cuporter.css +0 -64
- data/lib/cuporter/formatter/html_methods.rb +0 -122
- data/lib/cuporter/formatter/html_node_writer.rb +0 -104
- data/lib/cuporter/formatter/jquery-min.js +0 -154
- data/lib/cuporter/formatter/name_report/csv.rb +0 -12
- data/lib/cuporter/formatter/name_report/html.rb +0 -48
- data/lib/cuporter/formatter/name_report/html_node_writer.rb +0 -18
- data/lib/cuporter/formatter/name_report/text.rb +0 -16
- data/lib/cuporter/formatter/name_report/text_node_writer.rb +0 -16
- data/lib/cuporter/formatter/pretty_text_methods.rb +0 -22
- data/lib/cuporter/formatter/tag_report/csv.rb +0 -12
- data/lib/cuporter/formatter/tag_report/html.rb +0 -35
- data/lib/cuporter/formatter/tag_report/html_node_writer.rb +0 -19
- data/lib/cuporter/formatter/tag_report/text.rb +0 -14
- data/lib/cuporter/formatter/tag_report/text_node_writer.rb +0 -17
- data/lib/cuporter/formatter/text_methods.rb +0 -19
- data/lib/cuporter/formatter/writer.rb +0 -33
- data/lib/cuporter/name_list_parser.rb +0 -44
- data/lib/cuporter/node_numberer.rb +0 -18
- data/lib/cuporter/report/name_report.rb +0 -19
- data/lib/cuporter/report/report.rb +0 -22
- data/lib/cuporter/tag_list_node.rb +0 -54
- data/lib/cuporter/tag_list_parser.rb +0 -39
data/README.textile
CHANGED
@@ -1,40 +1,73 @@
|
|
1
1
|
h1. Cuporter
|
2
2
|
|
3
|
-
|
3
|
+
h3. A Cucumber Reporter
|
4
4
|
|
5
|
-
|
6
|
-
** in Feature and Scenario Outline context, as appropriate
|
7
|
-
** sorted alphbetically by file path, scenario name, scenario outline name, example name
|
8
|
-
** optionally numbered*, counting scenarios and outline examples per tag
|
9
|
-
# Inventory Report: feature, scenario and example names
|
10
|
-
** may be filtered by tags, using same CLI syntax as Cucumber
|
11
|
-
** sorted alphbetically by file path, scenario name, scenario outline name, example name
|
12
|
-
** optionally numbered*, using 1 count of all scenarios and outline examples for the report
|
5
|
+
Scrapes your feature files to show test counts and tag relationships.
|
13
6
|
|
14
|
-
|
7
|
+
h3. 3 Views
|
15
8
|
|
16
|
-
|
9
|
+
# Tag Report
|
10
|
+
** Tags listed with all features and scenarios associated with them
|
11
|
+
** Each scenario shows all of its tags, for simple cross referencing
|
12
|
+
# Feature Report
|
13
|
+
** Simple list of all Cucumber features, sorted by name and file name.
|
14
|
+
** Collapsable scenario and scenario outline breakdowns
|
15
|
+
** Totals, subtotals, scenario numbering
|
16
|
+
# Tree Report
|
17
|
+
** Expandy-collapsy jquery.treeview of your @features/**@ dir
|
18
|
+
** Same feature data as above
|
19
|
+
** Subtotals on folders
|
17
20
|
|
18
|
-
|
21
|
+
h3. 4 Output Formats
|
19
22
|
|
20
|
-
|
23
|
+
# html
|
24
|
+
# xml
|
25
|
+
# pretty-print text
|
26
|
+
# csv
|
27
|
+
|
28
|
+
h3. A bunch of configuration options
|
29
|
+
|
30
|
+
See the help output below.
|
21
31
|
|
22
32
|
---------
|
23
|
-
|
33
|
+
|
34
|
+
h3. Example Tag Report Ouput
|
35
|
+
|
36
|
+
|
37
|
+
h4. xml of single test
|
38
|
+
|
39
|
+
<notextile>
|
40
|
+
<pre>
|
41
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
42
|
+
<xml>
|
43
|
+
<body>
|
44
|
+
<report view="tag" title="Cucumber Tags" total="1">
|
45
|
+
<tag cuke_name="@just_me" total="1">
|
46
|
+
<feature cuke_name="Feature: Pretty print report on 3 features" file_path="features/pretty_print.feature" total="1">
|
47
|
+
<scenario cuke_name="Scenario: Tag report on everything in fixtures/self_test" tags="@just_me" number="1"/>
|
48
|
+
</feature>
|
49
|
+
</tag>
|
50
|
+
</report>
|
51
|
+
</body>
|
52
|
+
</xml>
|
53
|
+
</pre>
|
54
|
+
</notextile>
|
55
|
+
|
56
|
+
h4. numbered pretty text
|
24
57
|
|
25
58
|
<pre>
|
26
59
|
@failing
|
27
|
-
Feature: Abominable Aardvark
|
60
|
+
Feature: Abominable Aardvark @failing, @zoology
|
28
61
|
1. Scenario: An Aardvark eats ants
|
29
62
|
2. Scenario: Zee Zebra eats zee aardvark
|
30
|
-
Feature: Wired
|
31
|
-
3. Scenario: Everybody's Wired
|
63
|
+
Feature: Wired
|
64
|
+
3. Scenario: Everybody's Wired @failing
|
32
65
|
Scenario Outline: Why is everybody so wired?
|
33
66
|
Examples: loosely wired
|
34
67
|
| arg1 | arg2 |
|
35
68
|
4. | foo | bar |
|
36
69
|
5. | shif | fish |
|
37
|
-
Examples: tightly wired
|
70
|
+
Examples: tightly wired @ignore
|
38
71
|
| arg1 | arg2 |
|
39
72
|
6. | foo | bar |
|
40
73
|
7. | frotz | knurl |
|
@@ -66,6 +99,9 @@ h3. Install
|
|
66
99
|
$ gem install cuporter
|
67
100
|
</pre>
|
68
101
|
|
102
|
+
Once installed, you can run @$ cuporter@ anywhere on your system. In any project dir, it will read your @features/**@ by default.
|
103
|
+
If you clone the repo, you can run @$ ./bin/cuporter@ from within it.
|
104
|
+
|
69
105
|
---------
|
70
106
|
|
71
107
|
h3. Command Lines
|
@@ -73,45 +109,88 @@ h3. Command Lines
|
|
73
109
|
h4. help
|
74
110
|
|
75
111
|
<pre>
|
76
|
-
$
|
112
|
+
$ cuporter -h
|
77
113
|
|
78
114
|
Usage: cuporter [options]
|
115
|
+
|
116
|
+
-r, --report [tag|feature|tree] View, or type of report.
|
117
|
+
Default: "tag"
|
118
|
+
|
119
|
+
-f, --format [xml|html|csv|text] Output format.
|
120
|
+
Default: text (it's pretty, though!)
|
121
|
+
|
122
|
+
-i, --input-dir DIR Root directory of *.feature files.
|
123
|
+
Default: "features"
|
124
|
+
|
125
|
+
Used to build the glob pattern '[--in]/**/*.feature', which is really most likely
|
126
|
+
"features/**/*.features" and finds all feature files anywhere under "features" or
|
127
|
+
your custom root supplied with this option.
|
128
|
+
Overridden by "--file-input'.
|
129
|
+
|
130
|
+
-I, --file-input FILE Single *.feature file. Full name with extension, like 'path/to/file.feature.'
|
131
|
+
Overrides "--input-dir" and used mostly for testing.
|
132
|
+
|
133
|
+
-o, --output-file FILE Output file path, like 'tmp/cucumber/tag_report.html'.
|
134
|
+
|
135
|
+
-t, --tags TAG_EXPRESSION Filter on tags for name report.
|
136
|
+
TAG_EXPRESSION rules:
|
137
|
+
1. $ cucumber --help
|
138
|
+
2. http://github.com/aslakhellesoy/cucumber/wiki/Tags
|
139
|
+
|
140
|
+
-T, --title STRING Override report default title, which is different for each view/report.
|
141
|
+
This affects the xml 'report' node title and the html head > title attributes.
|
142
|
+
|
143
|
+
Reporting options: on by default but can be turned off:
|
144
|
+
|
145
|
+
--no-sort Do not sort tags, features, scenarios, or outlines
|
146
|
+
--no-number Do not get or show scenario or example numbers, (i.e., do not number the leaf nodes).
|
147
|
+
--no-total Do not get or show totals
|
148
|
+
--no-show-tags Do not show cucumber tags at the feature, scenario, or outline level.
|
149
|
+
--no-show-files Do not show feature file paths.
|
150
|
+
--no-leaves Show features only, with no scenarios or outlines.
|
151
|
+
|
79
152
|
|
80
|
-
|
81
|
-
Default: features/**/*.feature
|
153
|
+
</pre>
|
82
154
|
|
83
|
-
|
155
|
+
h4. Examples
|
84
156
|
|
85
|
-
|
157
|
+
<pre>
|
158
|
+
# pretty-print demo report to stdout
|
159
|
+
$ ./bin/cuporter -i fixtures/self_test
|
86
160
|
|
87
|
-
|
88
|
-
|
161
|
+
# same, XML to console
|
162
|
+
$ ./bin/cuporter -i fixtures/self_test -f xml
|
89
163
|
|
90
|
-
|
164
|
+
# List View: html without totals, xml without leaves (scenarios and examples)
|
165
|
+
$ cuporter -i fixtures/ -r feature -f html --no-total > redirecting_is_ok_too.html
|
166
|
+
$ cuporter -i fixtures/ -r feature -f xml -o fixtures_demo.xml --no-leaves
|
91
167
|
|
92
|
-
|
93
|
-
|
168
|
+
# Tree View of default input features/**/*.feature to
|
169
|
+
$ cuporter -f html -r tree -o feature_tree_view.html
|
94
170
|
|
95
|
-
|
96
|
-
|
171
|
+
# filtered html feature report, with non-default title
|
172
|
+
$ cuporter -f html -o active_customer.html -r feature -T "Active Customer Test Inventory" -t ~@wip -t @customer,@client
|
173
|
+
</pre>
|
97
174
|
|
98
|
-
|
99
|
-
Default: 'Cucumber Scenario Inventory'
|
175
|
+
----
|
100
176
|
|
101
|
-
|
177
|
+
h3. Dependencies
|
102
178
|
|
103
|
-
|
179
|
+
# Nokogiri 1.4.4 or above
|
180
|
+
** For all things Nodular: XML document building and XSL transformation into HTML
|
181
|
+
** Not tested on earlier versions yet but I'd guess you'll be fine with anything recent.
|
182
|
+
** @libxml2@ and @libxslt@ are required by this gem, which *should* handle them smoothly. However, @libxml@ and cousins
|
183
|
+
can at times present installation difficulties in the form of clashes with already-installed C resources. It has to do with very specific
|
184
|
+
lib versioning and installation order issues. It's not always the same problem,
|
185
|
+
so there's no prescription for it but Google, unfortunately.
|
186
|
+
# jQuery and jQueryTreeview
|
187
|
+
** packaged with the gem
|
188
|
+
** jquery.treeview relies on image files, so our tree view requires the HTML to link to its resources rather than copying them to the <head>.
|
104
189
|
|
105
|
-
|
106
|
-
# pretty-print demo report to stdout
|
107
|
-
$ ./bin/cuporter -i fixtures/self_text
|
190
|
+
h3. Acknowledgements
|
108
191
|
|
109
|
-
|
110
|
-
|
192
|
+
* Acknowledgements remain due to the Cucumber HTML formatter, and to the human one, too!.
|
193
|
+
* Thanks to everyone involved in Nokogiri, jQuery and the Treeview plugin.
|
111
194
|
|
112
|
-
|
113
|
-
$ ./bin/cuporter -f html -o feature_tag_report.html
|
195
|
+
I used to _"Consider this a stop-gap until we get this functionality in a proper cucumber formatter"_, but now I'm not so sure. Megalomania?
|
114
196
|
|
115
|
-
# filtered html name report, with non-default title
|
116
|
-
$ ./bin/cuporter -f html -o active_customer.html -r name -T "Active Customer Test Inventory" -t ~@wip -t @customer,@client
|
117
|
-
</pre>
|
data/Rakefile
CHANGED
@@ -27,13 +27,13 @@ namespace :cuporter do
|
|
27
27
|
desc "unit specs"
|
28
28
|
RSpec::Core::RakeTask.new(:unit) do |t|
|
29
29
|
t.pattern = "spec/cuporter/*_spec.rb"
|
30
|
-
t.
|
30
|
+
t.rspec_opts = ["--color" , "--format" , "doc" ]
|
31
31
|
end
|
32
32
|
|
33
33
|
desc "functional specs against feature fixtures"
|
34
34
|
RSpec::Core::RakeTask.new(:functional) do |t|
|
35
35
|
t.pattern = "spec/cuporter/functional/**/*_spec.rb"
|
36
|
-
t.
|
36
|
+
t.rspec_opts = ["--color" , "--format" , "doc" ]
|
37
37
|
end
|
38
38
|
|
39
39
|
desc "cucumber features"
|
@@ -56,7 +56,7 @@ namespace :cuporter do
|
|
56
56
|
|
57
57
|
spec = Gem::Specification.new do |s|
|
58
58
|
s.name = 'cuporter'
|
59
|
-
s.version = '0.3.
|
59
|
+
s.version = '0.3.3'
|
60
60
|
s.rubyforge_project = s.name
|
61
61
|
|
62
62
|
s.platform = Gem::Platform::RUBY
|
@@ -69,12 +69,12 @@ namespace :cuporter do
|
|
69
69
|
s.email = 'twcamper@thoughtworks.com'
|
70
70
|
s.homepage = 'http://github.com/twcamper/cuporter'
|
71
71
|
s.required_ruby_version = '>= 1.8.7'
|
72
|
-
s.add_dependency('
|
72
|
+
s.add_dependency('nokogiri', '>= 1.4.4')
|
73
73
|
s.default_executable = "cuporter"
|
74
74
|
s.executables = [s.default_executable]
|
75
75
|
|
76
76
|
s.files = %w(LICENSE README.textile Rakefile) +
|
77
|
-
FileList["lib/**/*.{rb,
|
77
|
+
FileList["lib/**/*.{rb,xslt}", "bin/*", "public/**/*.{css,js,gif}"].to_a
|
78
78
|
|
79
79
|
s.require_path = "lib"
|
80
80
|
end
|
data/bin/cuporter
CHANGED
@@ -1,17 +1,25 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
$LOAD_PATH.unshift File.expand_path('
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../lib', File.dirname(__FILE__))
|
4
4
|
require 'cuporter'
|
5
5
|
|
6
|
-
filter_args = Cuporter::CLI::FilterArgsBuilder.new(Cuporter::CLI::Options[:tags]).args
|
7
6
|
|
8
|
-
report = Cuporter::
|
9
|
-
Cuporter::CLI::Options[:input_file] || Cuporter::CLI::Options[:input_dir],
|
10
|
-
filter_args,
|
11
|
-
Cuporter::CLI::Options[:title])
|
7
|
+
report = Cuporter::ReportBase.create(Cuporter.options).build
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
9
|
+
(Cuporter.output_file || STDOUT).puts case Cuporter.options[:format]
|
10
|
+
when 'xml'
|
11
|
+
report.doc.to_xml(:indent => 2, :encoding => 'UTF-8')
|
12
|
+
when 'csv'
|
13
|
+
report.doc.to_csv
|
14
|
+
when 'text', 'pretty'
|
15
|
+
report.doc.to_text
|
16
|
+
when 'html'
|
17
|
+
html = Cuporter::Document.new_html(Cuporter.options[:report])
|
18
|
+
formatters = File.expand_path("../lib/cuporter/formatters", File.dirname(__FILE__))
|
19
|
+
xslt = Nokogiri::XSLT(File.read("#{formatters}/xml_to_html.xslt"))
|
20
|
+
html.add_report(xslt.transform(report.doc).at('.report'))
|
21
|
+
html.to_html
|
22
|
+
end
|
23
|
+
|
24
|
+
__END__
|
25
|
+
xsltproc --stringparam view feature lib/cuporter/formatters/xml_to_html.xslt new_feature.xml | ruby -e "f = STDIN.read; puts f.gsub(/\<\!--[\*\/]{2}--\>/, '')" | tee xslt_feature.html
|
data/lib/cuporter.rb
CHANGED
@@ -1,31 +1,20 @@
|
|
1
1
|
# Copyright 2010 ThoughtWorks, Inc. Licensed under the MIT License
|
2
|
-
|
3
|
-
|
4
|
-
require 'cuporter/
|
5
|
-
require 'cuporter/example_set_node'
|
6
|
-
require 'cuporter/node_numberer'
|
7
|
-
require 'cuporter/feature_parser'
|
8
|
-
require 'cuporter/tag_list_parser'
|
9
|
-
require 'cuporter/name_list_parser'
|
2
|
+
$LOAD_PATH.unshift( File.expand_path("#{File.dirname(__FILE__)}"))
|
3
|
+
$LOAD_PATH.unshift( File.expand_path("#{File.dirname(__FILE__)}/.."))
|
4
|
+
require 'cuporter/extensions/nokogiri'
|
10
5
|
require 'cuporter/extensions/string'
|
11
6
|
require 'cuporter/cli/options'
|
12
7
|
require 'cuporter/cli/filter_args_builder'
|
13
|
-
require 'cuporter/
|
8
|
+
require 'cuporter/node'
|
9
|
+
require 'cuporter/formatters/text'
|
10
|
+
require 'cuporter/formatters/csv'
|
11
|
+
require 'cuporter/filter'
|
12
|
+
require 'cuporter/feature_parser'
|
13
|
+
require 'cuporter/tag_nodes_parser'
|
14
|
+
require 'cuporter/node_parser'
|
15
|
+
require 'cuporter/document'
|
16
|
+
require 'cuporter/document/html_document'
|
17
|
+
require 'cuporter/report/report_base'
|
14
18
|
require 'cuporter/report/tag_report'
|
15
|
-
require 'cuporter/report/
|
16
|
-
require 'cuporter/
|
17
|
-
require 'cuporter/formatter/text_methods'
|
18
|
-
require 'cuporter/formatter/pretty_text_methods'
|
19
|
-
require 'cuporter/formatter/csv_text_methods'
|
20
|
-
require 'cuporter/formatter/html_node_writer'
|
21
|
-
require 'cuporter/formatter/html_methods'
|
22
|
-
require 'cuporter/formatter/tag_report/html'
|
23
|
-
require 'cuporter/formatter/tag_report/html_node_writer'
|
24
|
-
require 'cuporter/formatter/tag_report/text_node_writer'
|
25
|
-
require 'cuporter/formatter/tag_report/text'
|
26
|
-
require 'cuporter/formatter/tag_report/csv'
|
27
|
-
require 'cuporter/formatter/name_report/html'
|
28
|
-
require 'cuporter/formatter/name_report/html_node_writer'
|
29
|
-
require 'cuporter/formatter/name_report/text_node_writer'
|
30
|
-
require 'cuporter/formatter/name_report/text'
|
31
|
-
require 'cuporter/formatter/name_report/csv'
|
19
|
+
require 'cuporter/report/tree_report'
|
20
|
+
require 'cuporter/report/feature_report'
|
data/lib/cuporter/cli/options.rb
CHANGED
@@ -4,6 +4,7 @@ require 'fileutils'
|
|
4
4
|
|
5
5
|
module Cuporter
|
6
6
|
module CLI
|
7
|
+
|
7
8
|
class Options
|
8
9
|
|
9
10
|
def self.[](key)
|
@@ -11,59 +12,131 @@ module Cuporter
|
|
11
12
|
end
|
12
13
|
|
13
14
|
def self.options
|
14
|
-
|
15
|
+
unless @options
|
16
|
+
self.parse
|
17
|
+
@options[:input_file_pattern] = @options.delete(:input_file) || "#{@options.delete(:input_dir)}/**/*.feature"
|
18
|
+
@options[:root_dir] = @options[:input_file_pattern].split(File::SEPARATOR).first
|
19
|
+
@options[:filter_args] = Cuporter::CLI::FilterArgsBuilder.new(@options.delete(:tags)).args
|
20
|
+
end
|
15
21
|
@options
|
16
22
|
end
|
17
23
|
|
24
|
+
def self.args
|
25
|
+
@@args
|
26
|
+
end
|
27
|
+
|
18
28
|
def self.parse
|
29
|
+
@@args = ARGV.dup
|
19
30
|
@options = {}
|
20
31
|
OptionParser.new(ARGV.dup) do |opts|
|
21
32
|
opts.banner = "Usage: cuporter [options]\n\n"
|
22
33
|
|
23
|
-
@options[:
|
24
|
-
opts.on("-
|
25
|
-
|
34
|
+
@options[:report] = "tag"
|
35
|
+
opts.on("-r", "--report [tag|feature|tree]", %Q{View, or type of report.
|
36
|
+
Default: "tag"
|
37
|
+
}) do |r|
|
38
|
+
@options[:report] = (r == 'name' ? 'feature' : r)
|
26
39
|
end
|
27
40
|
|
28
|
-
|
41
|
+
@options[:format] = "text"
|
42
|
+
opts.on("-f", "--format [xml|html|csv|text]", %Q{Output format.
|
43
|
+
Default: text (it's pretty, though!)
|
44
|
+
}) do |f|
|
45
|
+
@options[:format] = f
|
46
|
+
end
|
47
|
+
|
48
|
+
@options[:input_dir] = "features"
|
49
|
+
opts.on("-i", "--input-dir DIR", %Q{Root directory of *.feature files.
|
50
|
+
Default: "features"
|
51
|
+
|
52
|
+
Used to build the glob pattern '[--in]/**/*.feature', which is really most likely
|
53
|
+
"features/**/*.features" and finds all feature files anywhere under "features" or
|
54
|
+
your custom root supplied with this option.
|
55
|
+
Overridden by "--file-input'.
|
56
|
+
}) do |i|
|
57
|
+
@options[:input_dir] = i.sub(/#{File::SEPARATOR}$/,'')
|
58
|
+
end
|
59
|
+
|
60
|
+
opts.on("-I", "--file-input FILE", %Q{Single *.feature file. Full name with extension, like 'path/to/file.feature.'
|
61
|
+
Overrides "--input-dir" and used mostly for testing.
|
62
|
+
}) do |file|
|
29
63
|
@options[:input_file] = file
|
30
64
|
end
|
31
|
-
|
65
|
+
|
66
|
+
@options[:output_file]
|
67
|
+
opts.on("-o", "--output-file FILE", %Q{Output file path, like 'tmp/cucumber/tag_report.html'.
|
68
|
+
}) do |o|
|
32
69
|
full_path = File.expand_path(o)
|
33
70
|
path = full_path.split(File::SEPARATOR)
|
34
71
|
file = path.pop
|
35
72
|
FileUtils.makedirs(path.join(File::SEPARATOR))
|
73
|
+
|
74
|
+
@options[:output_file] = full_path
|
75
|
+
end
|
36
76
|
|
37
|
-
|
77
|
+
@options[:tags] = []
|
78
|
+
opts.on("-t", "--tags TAG_EXPRESSION", %Q{Filter on tags for name report.
|
79
|
+
TAG_EXPRESSION rules:
|
80
|
+
1. $ cucumber --help
|
81
|
+
2. http://github.com/aslakhellesoy/cucumber/wiki/Tags
|
82
|
+
}) do |t|
|
83
|
+
@options[:tags] << t
|
38
84
|
end
|
39
|
-
|
40
|
-
opts.on("-
|
41
|
-
|
85
|
+
|
86
|
+
opts.on("-T", "--title STRING", %Q{Override report default title, which is different for each view/report.
|
87
|
+
This affects the xml 'report' node title and the html head > title attributes.
|
88
|
+
}) do |title|
|
89
|
+
@options[:title] = title
|
42
90
|
end
|
43
91
|
|
44
|
-
opts.
|
45
|
-
|
92
|
+
opts.separator "Reporting options: on by default but can be turned off:\n\n"
|
93
|
+
@options[:sort] = true
|
94
|
+
opts.on("--no-sort", "Do not sort tags, features, scenarios, or outlines\n") do |n|
|
95
|
+
@options[:sort] = n
|
46
96
|
end
|
47
97
|
|
48
|
-
@options[:
|
49
|
-
opts.on("-
|
50
|
-
@options[:
|
98
|
+
@options[:number] = true
|
99
|
+
opts.on("--no-number", "Do not get or show scenario or example numbers, (i.e., do not number the leaf nodes).\n") do |n|
|
100
|
+
@options[:number] = n
|
51
101
|
end
|
52
102
|
|
53
|
-
@options[:
|
54
|
-
opts.on("-
|
55
|
-
@options[:
|
103
|
+
@options[:total] = true
|
104
|
+
opts.on("--no-total", "Do not get or show totals\n") do |n|
|
105
|
+
@options[:total] = n
|
56
106
|
end
|
57
107
|
|
58
|
-
@options[:
|
59
|
-
opts.on("-
|
60
|
-
@options[:
|
108
|
+
@options[:show_tags] = true
|
109
|
+
opts.on("--no-show-tags", "Do not show cucumber tags at the feature, scenario, or outline level.\n") do |show_tags|
|
110
|
+
@options[:show_tags] = show_tags
|
61
111
|
end
|
62
112
|
|
63
|
-
|
113
|
+
@options[:show_files] = true
|
114
|
+
opts.on("--no-show-files", "Do not show feature file paths.\n") do |show_files|
|
115
|
+
@options[:show_files] = show_files
|
116
|
+
end
|
117
|
+
|
118
|
+
@options[:leaves] = true
|
119
|
+
opts.on("--no-leaves", "Show features only, with no scenarios or outlines.\n\n\n") do |l|
|
120
|
+
@options[:leaves] = l
|
121
|
+
end
|
64
122
|
|
123
|
+
end.parse!
|
65
124
|
|
66
125
|
end
|
67
126
|
end
|
68
127
|
end
|
128
|
+
|
129
|
+
def self.html?
|
130
|
+
CLI::Options[:format] == 'html'
|
131
|
+
end
|
132
|
+
|
133
|
+
def self.options
|
134
|
+
CLI::Options.options
|
135
|
+
end
|
136
|
+
|
137
|
+
def self.output_file
|
138
|
+
if options[:output_file]
|
139
|
+
File.open(options[:output_file], "w")
|
140
|
+
end
|
141
|
+
end
|
69
142
|
end
|