stepdown 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +13 -10
- data/History.txt +6 -0
- data/bin/stepdown +3 -1
- data/lib/stepdown.rb +9 -1
- data/lib/stepdown/analyzer.rb +11 -8
- data/lib/stepdown/feature_parser.rb +47 -17
- data/lib/stepdown/html_reporter.rb +2 -2
- data/lib/stepdown/options.rb +7 -2
- data/lib/stepdown/reporter.rb +11 -0
- data/lib/stepdown/scenario.rb +3 -2
- data/lib/stepdown/step_instance.rb +2 -2
- data/lib/stepdown/text_reporter.rb +3 -2
- data/spec/lib/stepdown/analyzer_spec.rb +32 -0
- data/spec/lib/stepdown/feature_parser_spec.rb +32 -25
- data/spec/lib/stepdown/options_spec.rb +5 -0
- data/spec/lib/stepdown/reporter_spec.rb +34 -6
- data/spec/lib/stepdown/scenario_spec.rb +1 -1
- data/stepdown.gemspec +4 -3
- data/templates/main.html.haml +14 -0
- metadata +30 -15
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,24 +2,27 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
diff-lcs (1.1.2)
|
5
|
-
|
5
|
+
gherkin (2.3.8)
|
6
|
+
json (>= 1.4.6)
|
7
|
+
haml (3.1.1)
|
8
|
+
json (1.4.6)
|
6
9
|
rake (0.8.7)
|
7
10
|
rcov (0.9.9)
|
8
|
-
rspec (2.
|
9
|
-
rspec-core (~> 2.
|
10
|
-
rspec-expectations (~> 2.
|
11
|
-
rspec-mocks (~> 2.
|
12
|
-
rspec-core (2.
|
13
|
-
rspec-expectations (2.
|
11
|
+
rspec (2.6.0)
|
12
|
+
rspec-core (~> 2.6.0)
|
13
|
+
rspec-expectations (~> 2.6.0)
|
14
|
+
rspec-mocks (~> 2.6.0)
|
15
|
+
rspec-core (2.6.0)
|
16
|
+
rspec-expectations (2.6.0)
|
14
17
|
diff-lcs (~> 1.1.2)
|
15
|
-
rspec-mocks (2.
|
18
|
+
rspec-mocks (2.6.0)
|
16
19
|
|
17
20
|
PLATFORMS
|
18
|
-
java
|
19
21
|
ruby
|
20
22
|
|
21
23
|
DEPENDENCIES
|
24
|
+
gherkin (~> 2.3)
|
22
25
|
haml (> 2.0.0)
|
23
26
|
rake
|
24
27
|
rcov (~> 0.9.9)
|
25
|
-
rspec (~> 2.5
|
28
|
+
rspec (~> 2.5)
|
data/History.txt
CHANGED
data/bin/stepdown
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
lib = File.expand_path('../lib/', __FILE__)
|
3
3
|
$:.unshift lib unless $:.include?(lib)
|
4
4
|
|
5
|
-
require 'stepdown'
|
6
5
|
require 'stepdown/options'
|
6
|
+
require 'stepdown'
|
7
7
|
|
8
8
|
begin
|
9
9
|
|
@@ -11,6 +11,8 @@ begin
|
|
11
11
|
options.parse(ARGV)
|
12
12
|
options.validate
|
13
13
|
|
14
|
+
Stepdown.quiet = options.quiet
|
15
|
+
|
14
16
|
Stepdown::Analyzer.new(options.steps_dir, options.features_dir, options.reporter).analyse
|
15
17
|
|
16
18
|
rescue Interrupt => e
|
data/lib/stepdown.rb
CHANGED
@@ -2,5 +2,13 @@ require 'stepdown/feature_parser'
|
|
2
2
|
require 'stepdown/step_instance'
|
3
3
|
require 'stepdown/html_reporter'
|
4
4
|
require 'stepdown/text_reporter'
|
5
|
-
|
6
5
|
require 'stepdown/analyzer'
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'bundler/setup'
|
9
|
+
|
10
|
+
module Stepdown
|
11
|
+
class << self
|
12
|
+
attr_accessor :quiet
|
13
|
+
end
|
14
|
+
end
|
data/lib/stepdown/analyzer.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require 'gherkin/parser/parser'
|
2
2
|
|
3
3
|
module Stepdown
|
4
4
|
class Analyzer
|
@@ -9,10 +9,10 @@ module Stepdown
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def analyse
|
12
|
-
puts "Parsing feature files..."
|
12
|
+
puts "Parsing feature files..." unless Stepdown.quiet
|
13
13
|
scenarios = process_feature_files(feature_files)
|
14
14
|
|
15
|
-
puts "Performing analysis..."
|
15
|
+
puts "Performing analysis..." unless Stepdown.quiet
|
16
16
|
|
17
17
|
reporter = reporter(@reporter, scenarios, instance.step_collection)
|
18
18
|
reporter.output_overview
|
@@ -20,13 +20,14 @@ module Stepdown
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def process_feature_files(feature_files)
|
23
|
-
|
23
|
+
listener = Stepdown::FeatureParser.new(instance)
|
24
|
+
|
25
|
+
parser = Gherkin::Parser::Parser.new(listener, true, 'root')
|
24
26
|
|
25
|
-
scenarios = []
|
26
27
|
feature_files.each do |feature_file|
|
27
|
-
|
28
|
+
parser.parse(File.read(feature_file), feature_file, 0)
|
28
29
|
end
|
29
|
-
scenarios
|
30
|
+
listener.scenarios
|
30
31
|
end
|
31
32
|
|
32
33
|
def reporter(type, scenarios, step_collection)
|
@@ -35,6 +36,8 @@ module Stepdown
|
|
35
36
|
Stepdown::HTMLReporter.new(scenarios, step_collection)
|
36
37
|
when "text"
|
37
38
|
Stepdown::TextReporter.new(scenarios, step_collection)
|
39
|
+
when "quiet"
|
40
|
+
Stepdown::Reporter.new(scenarios, step_collection)
|
38
41
|
end
|
39
42
|
end
|
40
43
|
|
@@ -64,4 +67,4 @@ module Stepdown
|
|
64
67
|
@step_files = Dir.glob(@steps_dir + '/**/*.rb')
|
65
68
|
end
|
66
69
|
end
|
67
|
-
end
|
70
|
+
end
|
@@ -3,28 +3,58 @@ require 'stepdown/scenario'
|
|
3
3
|
module Stepdown
|
4
4
|
class FeatureParser
|
5
5
|
|
6
|
-
def
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
scenarios << @scenario
|
15
|
-
else
|
16
|
-
step = instance.line_matches(line)
|
17
|
-
@scenario.add_step(step) if step
|
18
|
-
end
|
6
|
+
def initialize(instance)
|
7
|
+
@instance = instance
|
8
|
+
@scenarios = []
|
9
|
+
end
|
10
|
+
|
11
|
+
def scenarios
|
12
|
+
unless @scenarios.last == @current_scenario
|
13
|
+
@scenarios << @current_scenario
|
19
14
|
end
|
15
|
+
@scenarios.compact
|
16
|
+
end
|
17
|
+
|
18
|
+
def background(background)
|
19
|
+
@scenarios << @current_scenario
|
20
|
+
@current_scenario = Scenario.new(background.name)
|
21
|
+
end
|
22
|
+
|
23
|
+
def scenario(scenario)
|
24
|
+
@scenarios << @current_scenario
|
25
|
+
@current_scenario = Scenario.new(scenario.name)
|
26
|
+
end
|
27
|
+
|
28
|
+
def scenario_outline(scenario_outline)
|
29
|
+
@scenarios << @current_scenario
|
30
|
+
@current_scenario = Scenario.new(scenario_outline.name)
|
31
|
+
end
|
20
32
|
|
21
|
-
|
33
|
+
def step(step)
|
34
|
+
matched_step = @instance.line_matches(step.name)
|
35
|
+
@current_scenario.add_step(matched_step) if matched_step
|
22
36
|
end
|
23
37
|
|
24
|
-
|
25
|
-
|
26
|
-
|
38
|
+
def uri(*args) end
|
39
|
+
|
40
|
+
def feature(*args) end
|
41
|
+
|
42
|
+
def examples(*args) end
|
43
|
+
|
44
|
+
def comment(*args) end
|
45
|
+
|
46
|
+
def tag(*args) end
|
47
|
+
|
48
|
+
def table(*args) end
|
49
|
+
|
50
|
+
def py_string(*args) end
|
51
|
+
|
52
|
+
def eof(*args) end
|
53
|
+
|
54
|
+
def syntax_error(*args)
|
55
|
+
# raise "SYNTAX ERROR"
|
27
56
|
end
|
57
|
+
|
28
58
|
end
|
29
59
|
end
|
30
60
|
|
@@ -7,7 +7,7 @@ module Stepdown
|
|
7
7
|
class HTMLReporter < Reporter
|
8
8
|
|
9
9
|
def output_overview()
|
10
|
-
puts "Generating report..."
|
10
|
+
puts "Generating report..." unless Stepdown.quiet
|
11
11
|
FileUtils.mkdir_p(Reporter::OUTPUT_DIR)
|
12
12
|
copy_files
|
13
13
|
|
@@ -26,7 +26,7 @@ module Stepdown
|
|
26
26
|
|
27
27
|
out.close
|
28
28
|
|
29
|
-
|
29
|
+
puts "\nReport output to #{Reporter::OUTPUT_DIR}/analysis.html" unless Stepdown.quiet
|
30
30
|
end
|
31
31
|
|
32
32
|
protected
|
data/lib/stepdown/options.rb
CHANGED
@@ -2,14 +2,15 @@ require 'optparse'
|
|
2
2
|
|
3
3
|
module Stepdown
|
4
4
|
class Options
|
5
|
-
attr_reader :steps_dir, :features_dir, :reporter
|
5
|
+
attr_reader :steps_dir, :features_dir, :reporter, :quiet
|
6
6
|
|
7
|
-
OUTPUT_FORMATS = ["html", "text"]
|
7
|
+
OUTPUT_FORMATS = ["html", "text", "quiet"]
|
8
8
|
|
9
9
|
def parse(params)
|
10
10
|
@steps_dir = "features/step_definitions"
|
11
11
|
@features_dir = "features"
|
12
12
|
@reporter = "html"
|
13
|
+
@quiet = false
|
13
14
|
parser = OptionParser.new do |opts|
|
14
15
|
opts.banner = "Usage: stepdown step_definition_dir feature_file_directory"
|
15
16
|
|
@@ -27,6 +28,10 @@ module Stepdown
|
|
27
28
|
@features_dir = o
|
28
29
|
end
|
29
30
|
|
31
|
+
opts.on("--quiet", "-q", "Supress output") do |o|
|
32
|
+
@quiet = true
|
33
|
+
end
|
34
|
+
|
30
35
|
opts.on_tail("-h", "--help", "You're looking at it") do |o|
|
31
36
|
puts opts
|
32
37
|
exit
|
data/lib/stepdown/reporter.rb
CHANGED
@@ -83,6 +83,10 @@ module Stepdown
|
|
83
83
|
step_usages.select{|use| use.total_usage == 0}
|
84
84
|
end
|
85
85
|
|
86
|
+
def unused_step_count
|
87
|
+
unused_steps.length
|
88
|
+
end
|
89
|
+
|
86
90
|
def uniq_steps_per_scenario(scenarios)
|
87
91
|
total_steps = 0.0
|
88
92
|
uniq_steps = 0.0
|
@@ -101,6 +105,13 @@ module Stepdown
|
|
101
105
|
end
|
102
106
|
sprintf "%.2f", (step_count / scen_count)
|
103
107
|
end
|
108
|
+
|
109
|
+
def empty_scenarios
|
110
|
+
@scenarios.select do |scen|
|
111
|
+
scen.steps.empty?
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
104
115
|
end
|
105
116
|
end
|
106
117
|
|
data/lib/stepdown/scenario.rb
CHANGED
@@ -2,10 +2,11 @@ require 'stepdown/step_collection'
|
|
2
2
|
|
3
3
|
module Stepdown
|
4
4
|
class Scenario
|
5
|
-
attr_reader :step_count
|
6
|
-
def initialize
|
5
|
+
attr_reader :step_count, :name
|
6
|
+
def initialize(name)
|
7
7
|
@step_collection = Stepdown::StepCollection.new
|
8
8
|
@step_count = 0
|
9
|
+
@name = name
|
9
10
|
end
|
10
11
|
|
11
12
|
def add_step(step)
|
@@ -39,10 +39,10 @@ module Stepdown
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def line_matches(line)
|
42
|
-
stripped_line = line.strip.gsub(/^(And|Given|When|Then) (.*)$/,'\2')
|
42
|
+
#stripped_line = line.strip.gsub(/^(And|Given|When|Then) (.*)$/,'\2')
|
43
43
|
|
44
44
|
@steps.each_with_index do |regex,i|
|
45
|
-
match = regex.match(
|
45
|
+
match = regex.match(line)
|
46
46
|
if match
|
47
47
|
return step_collection.detect{|step| i == step.id}
|
48
48
|
end
|
@@ -4,11 +4,12 @@ module Stepdown
|
|
4
4
|
class TextReporter < Reporter
|
5
5
|
|
6
6
|
def output_overview
|
7
|
-
puts "Generating report..."
|
7
|
+
puts "Generating report..." unless Stepdown.quiet
|
8
8
|
output = File.new(Reporter::OUTPUT_DIR + '/analysis.txt', "w+")
|
9
9
|
|
10
10
|
output.puts "Total number of scenarios: #{total_scenarios}"
|
11
11
|
output.puts "Total numer of steps: #{total_steps}"
|
12
|
+
output.puts "Unused steps: #{unused_step_count}"
|
12
13
|
output.puts "Steps per scenario: #{steps_per_scenario}"
|
13
14
|
output.puts "Unique steps per scenario: #{unique_steps}"
|
14
15
|
|
@@ -21,7 +22,7 @@ module Stepdown
|
|
21
22
|
|
22
23
|
output.close
|
23
24
|
|
24
|
-
puts "Report output to #{Reporter::OUTPUT_DIR}/analysis.txt"
|
25
|
+
puts "Report output to #{Reporter::OUTPUT_DIR}/analysis.txt" unless Stepdown.quiet
|
25
26
|
|
26
27
|
end
|
27
28
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'analyzer'
|
3
|
+
require 'reporter'
|
4
|
+
require 'html_reporter'
|
5
|
+
require 'text_reporter'
|
6
|
+
|
7
|
+
describe Stepdown::Analyzer do
|
8
|
+
|
9
|
+
describe "selecting a reporter" do
|
10
|
+
|
11
|
+
it "should return an HTML reporter" do
|
12
|
+
analyzer = Stepdown::Analyzer.new('', '', 'html')
|
13
|
+
reporter = analyzer.reporter('html',[],mock('step_collection'))
|
14
|
+
reporter.should be_instance_of(Stepdown::HTMLReporter)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should return a text reporter" do
|
18
|
+
analyzer = Stepdown::Analyzer.new('', '', 'text')
|
19
|
+
reporter = analyzer.reporter('text',[],mock('step_collection'))
|
20
|
+
reporter.should be_instance_of(Stepdown::TextReporter)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should return a quiet reporter" do
|
24
|
+
analyzer = Stepdown::Analyzer.new('', '', 'quiet')
|
25
|
+
reporter = analyzer.reporter('quiet',[],mock('step_collection'))
|
26
|
+
reporter.should be_instance_of(Stepdown::Reporter)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
@@ -9,45 +9,49 @@ describe Stepdown::FeatureParser do
|
|
9
9
|
|
10
10
|
describe "creating scenarios" do
|
11
11
|
before :each do
|
12
|
+
instance = mock("instance")
|
13
|
+
@parser = Stepdown::FeatureParser.new(instance)
|
12
14
|
end
|
13
|
-
it "should create a scenario for a scenario line" do
|
14
15
|
|
15
|
-
|
16
|
-
instance = mock("instance")
|
17
|
-
file_lines = ["Scenario: My testing scenario"]
|
16
|
+
it "should create a scenario for a scenario line" do
|
18
17
|
|
19
|
-
|
20
|
-
@parser.should_receive(:read_feature_file).with(file).and_return(file_lines)
|
21
|
-
scenario = mock("scenario")
|
18
|
+
scenario = mock("scenario", :name => 'scenario')
|
22
19
|
Stepdown::Scenario.should_receive(:new).and_return(scenario)
|
23
|
-
|
24
|
-
|
20
|
+
@parser.scenario(scenario)
|
21
|
+
|
22
|
+
@parser.scenarios.should =~ [scenario]
|
25
23
|
end
|
26
24
|
|
27
25
|
it "should create a scenario for a background line" do
|
28
|
-
file = mock("file")
|
29
|
-
instance = mock("instance")
|
30
|
-
file_lines = ["Background: My testing scenario"]
|
31
26
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
27
|
+
background = mock("background", :name => '')
|
28
|
+
Stepdown::Scenario.should_receive(:new).and_return(background)
|
29
|
+
@parser.background(background)
|
30
|
+
|
31
|
+
@parser.scenarios.should =~ [background]
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should create a scenario for a scenario outline" do
|
35
|
+
|
36
|
+
outline = mock("outline", :name => 'outline')
|
37
|
+
Stepdown::Scenario.should_receive(:new).and_return(outline)
|
38
|
+
@parser.scenario_outline(outline)
|
39
|
+
|
40
|
+
@parser.scenarios.should =~ [outline]
|
38
41
|
end
|
39
42
|
end
|
40
43
|
|
41
44
|
|
42
45
|
describe "parsing step lines" do
|
43
46
|
before :each do
|
44
|
-
@parser = Stepdown::FeatureParser.new
|
45
47
|
@step_instance = mock("step_instance")
|
48
|
+
@parser = Stepdown::FeatureParser.new(@step_instance)
|
49
|
+
@parser.scenario(mock('scenario', :name => 'scenario'))
|
46
50
|
|
47
51
|
end
|
48
52
|
|
49
53
|
it "should not add unmatched steps" do
|
50
|
-
lines = ["
|
54
|
+
lines = ["matched", "match 2"]
|
51
55
|
unmatched_lines = ["not matched", "not matched 2"]
|
52
56
|
steps = []
|
53
57
|
lines.each_with_index do |line, i|
|
@@ -61,23 +65,26 @@ describe Stepdown::FeatureParser do
|
|
61
65
|
end
|
62
66
|
|
63
67
|
all_lines = [lines, unmatched_lines].flatten
|
64
|
-
@parser.should_receive(:read_feature_file).and_return(all_lines)
|
65
68
|
|
66
|
-
|
69
|
+
all_lines.each do |line|
|
70
|
+
@parser.step(mock('step', :name => line))
|
71
|
+
end
|
72
|
+
|
73
|
+
scenarios = @parser.scenarios
|
67
74
|
scenarios.first.steps.collect{|s| s.regex }.should =~ ["matched", "match 2"]
|
68
75
|
end
|
69
76
|
|
70
77
|
it "should add matched steps" do
|
71
|
-
lines = ["
|
78
|
+
lines = ["matched", "match 2"]
|
72
79
|
steps = []
|
73
80
|
lines.each_with_index do |line, i|
|
74
81
|
step = Stepdown::Step.new(i, line)
|
75
82
|
stub_line_match_with(@step_instance, line, step)
|
83
|
+
@parser.step(mock('step', :name => line))
|
76
84
|
steps << step
|
77
85
|
end
|
78
|
-
@parser.should_receive(:read_feature_file).and_return(lines)
|
79
86
|
|
80
|
-
scenarios = @parser.
|
87
|
+
scenarios = @parser.scenarios
|
81
88
|
scenarios.first.steps.collect{|s| s.regex }.should =~ ["matched", "match 2"]
|
82
89
|
|
83
90
|
end
|
@@ -87,6 +87,11 @@ describe Stepdown::Options do
|
|
87
87
|
@io.string.should == "Directory features_dir does not exist"
|
88
88
|
end.should raise_error(SystemExit)
|
89
89
|
end
|
90
|
+
|
91
|
+
it "should allow output to be supressed" do
|
92
|
+
@options.parse(["-q"])
|
93
|
+
@options.quiet.should == true
|
94
|
+
end
|
90
95
|
end
|
91
96
|
|
92
97
|
end
|
@@ -41,8 +41,8 @@ describe Stepdown::Reporter do
|
|
41
41
|
#this whole grouping thing needs to be refactored. Nasty.
|
42
42
|
describe "creating step groupings" do
|
43
43
|
before :each do
|
44
|
-
@scen_1 = Stepdown::Scenario.new
|
45
|
-
@scen_2 = Stepdown::Scenario.new
|
44
|
+
@scen_1 = Stepdown::Scenario.new('scenario')
|
45
|
+
@scen_2 = Stepdown::Scenario.new('scenario')
|
46
46
|
@scenarios = [@scen_1, @scen_2]
|
47
47
|
|
48
48
|
@collection = Stepdown::StepCollection.new
|
@@ -100,8 +100,8 @@ describe Stepdown::Reporter do
|
|
100
100
|
#this usage thing needs to be refactored as well
|
101
101
|
describe "creating step usages" do
|
102
102
|
before :each do
|
103
|
-
@scen_1 = Stepdown::Scenario.new
|
104
|
-
@scen_2 = Stepdown::Scenario.new
|
103
|
+
@scen_1 = Stepdown::Scenario.new('scenario')
|
104
|
+
@scen_2 = Stepdown::Scenario.new('scenario')
|
105
105
|
@scenarios = [@scen_1, @scen_2]
|
106
106
|
|
107
107
|
@collection = Stepdown::StepCollection.new
|
@@ -172,13 +172,41 @@ describe Stepdown::Reporter do
|
|
172
172
|
@reporter.stub!(:step_usages).and_return([@use_1, @use_2, @use_3])
|
173
173
|
end
|
174
174
|
|
175
|
-
it "should return
|
175
|
+
it "should return used steps" do
|
176
176
|
@reporter.usages.should =~ [@use_1, @use_2]
|
177
177
|
end
|
178
178
|
|
179
|
-
it "should return
|
179
|
+
it "should return unused steps" do
|
180
180
|
@reporter.unused_steps.should =~ [@use_3]
|
181
181
|
end
|
182
|
+
|
183
|
+
it "should return the number of unused steps" do
|
184
|
+
@reporter.unused_step_count.should == 1
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
describe "returning empty scenarios" do
|
189
|
+
|
190
|
+
it "should return scenarios with no steps" do
|
191
|
+
scen_1 = Stepdown::Scenario.new('scenario')
|
192
|
+
scen_2 = Stepdown::Scenario.new('scenario')
|
193
|
+
|
194
|
+
@reporter = Stepdown::Reporter.new([scen_1, scen_2], Stepdown::StepCollection.new)
|
195
|
+
|
196
|
+
@reporter.empty_scenarios().should == [scen_1,scen_2]
|
197
|
+
end
|
198
|
+
|
199
|
+
it "should not return scenarios with steps" do
|
200
|
+
scen_1 = Stepdown::Scenario.new('scenario')
|
201
|
+
scen_2 = Stepdown::Scenario.new('scenario')
|
202
|
+
|
203
|
+
scen_1.add_step(Stepdown::Step.new(1,/regex/))
|
204
|
+
|
205
|
+
@reporter = Stepdown::Reporter.new([scen_1, scen_2], Stepdown::StepCollection.new)
|
206
|
+
|
207
|
+
@reporter.empty_scenarios().should == [scen_2]
|
208
|
+
end
|
209
|
+
|
182
210
|
end
|
183
211
|
|
184
212
|
end
|
@@ -5,7 +5,7 @@ require 'step'
|
|
5
5
|
|
6
6
|
describe Stepdown::Scenario do
|
7
7
|
before :each do
|
8
|
-
@scenario = Stepdown::Scenario.new
|
8
|
+
@scenario = Stepdown::Scenario.new('scenario')
|
9
9
|
@s1 = Stepdown::Step.new(1, /step 1/)
|
10
10
|
@s2 = Stepdown::Step.new(2, /Step 2/)
|
11
11
|
@s2_dup = Stepdown::Step.new(2, /Step 2/)
|
data/stepdown.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = "stepdown"
|
4
|
-
s.version = "0.
|
4
|
+
s.version = "0.5.0"
|
5
5
|
s.platform = Gem::Platform::RUBY
|
6
6
|
s.required_ruby_version = '>= 1.8.7'
|
7
7
|
s.authors = "Sean Caffery"
|
@@ -13,8 +13,9 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.required_rubygems_version = ">= 1.3.6"
|
14
14
|
s.rubyforge_project = "stepdown"
|
15
15
|
|
16
|
-
s.add_dependency('haml', '> 2.0
|
17
|
-
s.
|
16
|
+
s.add_dependency('haml', '> 2.0')
|
17
|
+
s.add_dependency('gherkin', '~> 2.3')
|
18
|
+
s.add_development_dependency('rspec', "~> 2.5")
|
18
19
|
s.add_development_dependency('rake')
|
19
20
|
s.files = `git ls-files`.split("\n")
|
20
21
|
s.test_files = `git ls-files spec/*`.split("\n")
|
data/templates/main.html.haml
CHANGED
@@ -18,6 +18,8 @@
|
|
18
18
|
%a{:href => '#usage'} Step usage
|
19
19
|
%li
|
20
20
|
%a{:href => '#unused'} Unused steps
|
21
|
+
%li
|
22
|
+
%a{:href => '#empty'} Empty scenarios
|
21
23
|
%li
|
22
24
|
%a{:href => '#grouping'} Step grouping
|
23
25
|
#content
|
@@ -34,6 +36,9 @@
|
|
34
36
|
%tr
|
35
37
|
%td Total number of steps
|
36
38
|
%td= total_steps
|
39
|
+
%tr
|
40
|
+
%td Unused stepss
|
41
|
+
%td= unused_step_count
|
37
42
|
%tr
|
38
43
|
%td Steps per scenario
|
39
44
|
%td= steps_per_scenario
|
@@ -90,6 +95,15 @@
|
|
90
95
|
- unused_steps.each do |use|
|
91
96
|
%tr
|
92
97
|
%td= use.step.regex.inspect
|
98
|
+
%h2
|
99
|
+
%a{:name => 'empty'} Empty scenarios
|
100
|
+
%table
|
101
|
+
%tbody
|
102
|
+
%th Scenarios
|
103
|
+
|
104
|
+
- empty_scenarios.each do |scen|
|
105
|
+
%tr
|
106
|
+
%td= scen.name
|
93
107
|
%h2
|
94
108
|
%a{:name => 'grouping'} Step grouping
|
95
109
|
%table
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stepdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 5
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sean Caffery
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-05-17 00:00:00 +10:00
|
19
19
|
default_executable: stepdown
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,34 +26,47 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 3
|
30
30
|
segments:
|
31
31
|
- 2
|
32
32
|
- 0
|
33
|
-
|
34
|
-
version: 2.0.0
|
33
|
+
version: "2.0"
|
35
34
|
type: :runtime
|
36
35
|
version_requirements: *id001
|
37
36
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
37
|
+
name: gherkin
|
39
38
|
prerelease: false
|
40
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
40
|
none: false
|
42
41
|
requirements:
|
43
42
|
- - ~>
|
44
43
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
44
|
+
hash: 5
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 3
|
48
|
+
version: "2.3"
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: rspec
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 9
|
46
60
|
segments:
|
47
61
|
- 2
|
48
62
|
- 5
|
49
|
-
|
50
|
-
version: 2.5.0
|
63
|
+
version: "2.5"
|
51
64
|
type: :development
|
52
|
-
version_requirements: *
|
65
|
+
version_requirements: *id003
|
53
66
|
- !ruby/object:Gem::Dependency
|
54
67
|
name: rake
|
55
68
|
prerelease: false
|
56
|
-
requirement: &
|
69
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
57
70
|
none: false
|
58
71
|
requirements:
|
59
72
|
- - ">="
|
@@ -63,7 +76,7 @@ dependencies:
|
|
63
76
|
- 0
|
64
77
|
version: "0"
|
65
78
|
type: :development
|
66
|
-
version_requirements: *
|
79
|
+
version_requirements: *id004
|
67
80
|
description: Stepdown allows you to see where your most used Cucumber steps are, your unused steps and how they are clustered
|
68
81
|
email:
|
69
82
|
- sean@lineonpoint.com
|
@@ -97,6 +110,7 @@ files:
|
|
97
110
|
- lib/stepdown/text_reporter.rb
|
98
111
|
- public/jquery-1.4.3.min.js
|
99
112
|
- public/step_down.js
|
113
|
+
- spec/lib/stepdown/analyzer_spec.rb
|
100
114
|
- spec/lib/stepdown/feature_parser_spec.rb
|
101
115
|
- spec/lib/stepdown/options_spec.rb
|
102
116
|
- spec/lib/stepdown/reporter_spec.rb
|
@@ -142,11 +156,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
156
|
requirements: []
|
143
157
|
|
144
158
|
rubyforge_project: stepdown
|
145
|
-
rubygems_version: 1.
|
159
|
+
rubygems_version: 1.4.2
|
146
160
|
signing_key:
|
147
161
|
specification_version: 3
|
148
162
|
summary: Static analysis tool for Cucumber features
|
149
163
|
test_files:
|
164
|
+
- spec/lib/stepdown/analyzer_spec.rb
|
150
165
|
- spec/lib/stepdown/feature_parser_spec.rb
|
151
166
|
- spec/lib/stepdown/options_spec.rb
|
152
167
|
- spec/lib/stepdown/reporter_spec.rb
|