multicuke 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/multicuke/runner.rb +55 -19
- data/lib/multicuke/version.rb +1 -1
- data/lib/multicuke.rb +1 -1
- data/spec/dryrun_spec.rb +5 -4
- data/spec/features_dir_spec.rb +14 -0
- metadata +4 -2
data/lib/multicuke/runner.rb
CHANGED
@@ -4,7 +4,40 @@ require 'nokogiri'
|
|
4
4
|
require 'ostruct'
|
5
5
|
|
6
6
|
module Multicuke
|
7
|
-
|
7
|
+
|
8
|
+
# Set of features under one specific directory
|
9
|
+
class FeaturesDir
|
10
|
+
|
11
|
+
# Directory name fo the features
|
12
|
+
attr_reader :name
|
13
|
+
|
14
|
+
# Result string for passed/failed scenarios
|
15
|
+
attr_accessor :scenarios_results
|
16
|
+
|
17
|
+
# Result string for passed/failed steps
|
18
|
+
attr_accessor :steps_results
|
19
|
+
|
20
|
+
# Running time in ms for all features in this feature directory
|
21
|
+
attr_accessor :duration
|
22
|
+
|
23
|
+
# True if a scenario or step has failed for this set of features
|
24
|
+
attr_writer :failed
|
25
|
+
|
26
|
+
def initialize(dir_name)
|
27
|
+
@name = dir_name
|
28
|
+
@failed = false
|
29
|
+
end
|
30
|
+
|
31
|
+
def failed?
|
32
|
+
@failed
|
33
|
+
end
|
34
|
+
|
35
|
+
def human_name
|
36
|
+
name.gsub(/[_-]/, " ").capitalize
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
8
41
|
class Runner
|
9
42
|
|
10
43
|
attr_accessor :features_dir_path
|
@@ -28,9 +61,9 @@ module Multicuke
|
|
28
61
|
index_file = File.new(index_file_path, "w")
|
29
62
|
|
30
63
|
unless dry_run
|
31
|
-
|
32
|
-
report_file_path = File.join(reports_path, "#{
|
33
|
-
feature_full_path = File.join(features_dir_path, "#{
|
64
|
+
features_dirs.each { |features_dir|
|
65
|
+
report_file_path = File.join(reports_path, "#{features_dir.name}.html")
|
66
|
+
feature_full_path = File.join(features_dir_path, "#{features_dir.name}")
|
34
67
|
fork {
|
35
68
|
command = "bundle exec cucumber #{feature_full_path} -r #{features_dir_path} --format html --out #{report_file_path}"
|
36
69
|
p "RUNNING #{command}"
|
@@ -41,8 +74,8 @@ module Multicuke
|
|
41
74
|
}
|
42
75
|
end
|
43
76
|
|
44
|
-
|
45
|
-
feature_file = File.join(reports_path, "#{
|
77
|
+
features_dirs.each { |features_dir|
|
78
|
+
feature_file = File.join(reports_path, "#{features_dir.name}.html")
|
46
79
|
File.open(feature_file) { |file|
|
47
80
|
content = file.read
|
48
81
|
duration_match = content.match(/Finished in\s+<\w+>(.*?)</)
|
@@ -53,7 +86,10 @@ module Multicuke
|
|
53
86
|
steps = steps_match ? steps_match.captures.first : ""
|
54
87
|
failed = (scenarios.include?"failed") || (steps.include?"failed")
|
55
88
|
|
56
|
-
|
89
|
+
features_dir.scenarios_results = scenarios
|
90
|
+
features_dir.steps_results = steps
|
91
|
+
features_dir.duration = duration
|
92
|
+
features_dir.failed = failed
|
57
93
|
} if File.exists?(feature_file)
|
58
94
|
}
|
59
95
|
|
@@ -66,11 +102,11 @@ module Multicuke
|
|
66
102
|
b.body {
|
67
103
|
b.h2("Features")
|
68
104
|
b.ul {
|
69
|
-
|
70
|
-
b.li(:class => (
|
71
|
-
b.a(
|
72
|
-
b.span("[#{
|
73
|
-
b.span("Scenarios: #{
|
105
|
+
features_dirs.each { |features_dir|
|
106
|
+
b.li(:class => (features_dir.failed? ? "failed" : "success")) {
|
107
|
+
b.a(features_dir.human_name, :href => "#{features_dir.name}.html")
|
108
|
+
b.span("[#{features_dir.duration}]", :class => "duration")
|
109
|
+
b.span("Scenarios: #{features_dir.scenarios_results}, Steps: #{features_dir.steps_results}", :class => "result")
|
74
110
|
}
|
75
111
|
}
|
76
112
|
}
|
@@ -98,20 +134,20 @@ module Multicuke
|
|
98
134
|
path.match(Regexp.new(excluded_dirs.join("|")))
|
99
135
|
end
|
100
136
|
|
101
|
-
def
|
102
|
-
@
|
137
|
+
def features_dirs
|
138
|
+
@features_dirs ||= find_features_dirs
|
103
139
|
end
|
104
140
|
|
105
|
-
def
|
106
|
-
@
|
141
|
+
def find_features_dirs
|
142
|
+
@features_dirs = []
|
107
143
|
Dir.glob(File.join(features_dir_path, "*")).reject{ |path|
|
108
144
|
File.file?(path) || match_excluded_dirs(path)
|
109
145
|
}.map { |feature_path|
|
110
146
|
File.basename(feature_path)
|
111
|
-
}.each { |
|
112
|
-
@
|
147
|
+
}.each { |dir_name|
|
148
|
+
@features_dirs << FeaturesDir.new(dir_name)
|
113
149
|
}
|
114
|
-
@
|
150
|
+
@features_dirs
|
115
151
|
end
|
116
152
|
|
117
153
|
end
|
data/lib/multicuke/version.rb
CHANGED
data/lib/multicuke.rb
CHANGED
data/spec/dryrun_spec.rb
CHANGED
@@ -36,10 +36,11 @@ module Multicuke
|
|
36
36
|
File.open("#{RESULTS_DIR_PATH}/cucumber_reports/index.html") { |file|
|
37
37
|
content = file.read
|
38
38
|
content.should match /.*Cucumber reports.*/
|
39
|
-
content.should match /.*<a href="addition.html">
|
40
|
-
content.should match /.*<a href="substraction.html">
|
41
|
-
content.should match /.*<a href="division.html">
|
42
|
-
content.should match /.*<a href="
|
39
|
+
content.should match /.*<a href="addition.html">Addition<\/a>.*/
|
40
|
+
content.should match /.*<a href="substraction.html">Substraction<\/a>.*/
|
41
|
+
content.should match /.*<a href="division.html">Division<\/a>.*/
|
42
|
+
content.should match /.*<a href="bad_addition.html">Bad addition<\/a>.*/
|
43
|
+
content.should match /.*<a href="multiplication.html">Multiplication<\/a>.*/
|
43
44
|
content.should_not match /.*steps_definition.*/
|
44
45
|
}
|
45
46
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Multicuke
|
4
|
+
|
5
|
+
describe FeaturesDir do
|
6
|
+
it "return human readable directory name" do
|
7
|
+
features = FeaturesDir.new("bye_bye_blackbird")
|
8
|
+
features.human_name.should == "Bye bye blackbird"
|
9
|
+
other_features = FeaturesDir.new("bye-bye-blackbird")
|
10
|
+
other_features.human_name.should == "Bye bye blackbird"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multicuke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-01 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Run your features faster
|
15
15
|
email:
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- spec/features/random_file.rb
|
36
36
|
- spec/features/steps_definition/step_definitions.rb
|
37
37
|
- spec/features/substraction/substract_numbers.feature
|
38
|
+
- spec/features_dir_spec.rb
|
38
39
|
- spec/fork_spec.rb
|
39
40
|
- spec/runner_spec.rb
|
40
41
|
- spec/spec_helper.rb
|
@@ -72,6 +73,7 @@ test_files:
|
|
72
73
|
- spec/features/random_file.rb
|
73
74
|
- spec/features/steps_definition/step_definitions.rb
|
74
75
|
- spec/features/substraction/substract_numbers.feature
|
76
|
+
- spec/features_dir_spec.rb
|
75
77
|
- spec/fork_spec.rb
|
76
78
|
- spec/runner_spec.rb
|
77
79
|
- spec/spec_helper.rb
|