cuker 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89e1c299c23ac7c408ab34a8deb181bab472ae2330e58b0e20d4a2a77dcbc1ca
|
4
|
+
data.tar.gz: 6c0cbf41cc757bf61ab8047dd35abb3b81678953d4ba0d0b9cd48ccdd847af2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a2dc9582fd4ec718b4f3c7c8546a0f9c9481cf650d507c09c4cdb0f064f5f86384e8ea19a3a38f3f2cc3ded8a9ad3f24b7220e34ad12bc51edadaf7ddb65b31
|
7
|
+
data.tar.gz: 07d45b3ddf974c45ea1ce7d58b93a547ee35aacd12d91b29bbfe838b3612d46ef67a7342a30a6d3af5b1fdaaf2b6c4795d2058c058e754bdea945f93507b0997
|
data/lib/cuker/cuker_cmd.rb
CHANGED
@@ -36,7 +36,7 @@ module Cuker
|
|
36
36
|
# desc "report PRESET_KEY [FEATURE_PATH [REPORT_PATH [REPORT_FILE_NAME [LOG_LEVEL]]]]",
|
37
37
|
# "reports parsed results into \nREPORT_PATH/REPORT_FILE_NAME \nfor all '*.feature' files in the given FEATURE_PATH\nSTDIO LOG_LEVEL adjustable\n"
|
38
38
|
|
39
|
-
def report
|
39
|
+
def report(preset_key,
|
40
40
|
feat_path = "../",
|
41
41
|
report_file_name = 'sample_report',
|
42
42
|
report_path_input = ".",
|
@@ -47,6 +47,7 @@ module Cuker
|
|
47
47
|
"@test_done",
|
48
48
|
],
|
49
49
|
log_level = :info
|
50
|
+
)
|
50
51
|
|
51
52
|
init_logger log_level
|
52
53
|
output_files = []
|
@@ -58,7 +59,7 @@ module Cuker
|
|
58
59
|
|
59
60
|
producers.each do |producer|
|
60
61
|
report_path = File.join report_path_input, 'reports', LOG_TIME_TODAY
|
61
|
-
msg = "producing '#{producer.to_s.upcase}'
|
62
|
+
msg = "producing '#{producer.to_s.upcase}'\treport @ '#{report_path}' - '#{report_file_name}'\t for Feature Files @ '#{feat_path}'\n"
|
62
63
|
|
63
64
|
@log.info msg
|
64
65
|
puts msg
|
@@ -63,62 +63,105 @@ module Cuker
|
|
63
63
|
|
64
64
|
feat_counter = 0
|
65
65
|
feature_title = []
|
66
|
+
feature_tags_ary = []
|
66
67
|
bg_title = []
|
68
|
+
bg_tags_ary = []
|
67
69
|
|
68
70
|
res = []
|
69
71
|
@asts.each do |file_path, ast|
|
70
72
|
@log.debug "Understanding file: #{file_path}"
|
71
73
|
@file_path = file_path
|
72
74
|
in_feat_counter = 0
|
75
|
+
@no_feature_content = false
|
73
76
|
|
74
77
|
if ast[:type] == :GherkinDocument
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
row_hsh[:counter] = feat_counter
|
89
|
-
row_hsh[:s_type] = type == :Scenario ? "S" : "SO"
|
90
|
-
row_hsh[:s_title] = excel_content_format scen_title
|
91
|
-
|
92
|
-
all_tags = [feat_tags_ary, tags_ary].flatten.compact
|
93
|
-
ordered_list, ignore_list, select_list = filter_special_tags(all_tags)
|
94
|
-
row_hsh[:tags] = ordered_list
|
95
|
-
row_hsh[:other_tags] = ignore_list.join ", "
|
96
|
-
row_hsh[:feature_title] = excel_content_format feature_title
|
97
|
-
row_hsh[:bg_title] = excel_content_format bg_title
|
98
|
-
row_hsh[:file_s_num] = in_feat_counter += 1
|
99
|
-
row_hsh[:feature_count] = in_feat_counter == 1 ? 1 : 0
|
100
|
-
row_hsh[:file_name] = file_path
|
101
|
-
|
102
|
-
# row_hsh[:examples] = "" # is nil by default
|
103
|
-
if type == :ScenarioOutline
|
104
|
-
row_hsh[:examples] = example_count example_ary
|
105
|
-
end
|
106
|
-
row_ary = []
|
107
|
-
get_keys_ary(@order).each do |k|
|
108
|
-
if k == :tags
|
109
|
-
# v.each { |tag| row_ary << (tag.nil?? EXCEL_BLANK : tag) }
|
110
|
-
tags_ary = row_hsh[k]
|
111
|
-
tags_ary.each {|tag| row_ary << tag}
|
112
|
-
else
|
113
|
-
row_ary << (row_hsh[k])
|
78
|
+
# feat_counter += 1
|
79
|
+
if ast[:feature]
|
80
|
+
in_feature(ast) do |feat_tags_ary, feat_title, feat_item|
|
81
|
+
@no_feature_content = true
|
82
|
+
if feat_item
|
83
|
+
in_item(feat_item) do |tags_ary, type, item_title, content_ary, example_ary|
|
84
|
+
feature_title = feat_title
|
85
|
+
feature_tags_ary = feat_tags_ary
|
86
|
+
if type == :Background or type == :Feature
|
87
|
+
# bg_title = [excel_title(BACKGROUND, item_title)] + content_ary
|
88
|
+
bg_title = item_title
|
89
|
+
bg_tags_ary = tags_ary
|
90
|
+
next
|
114
91
|
end
|
92
|
+
row_hsh = {}
|
93
|
+
# if type == :Scenario or type == :ScenarioOutline
|
94
|
+
# scen_title = [excel_title(type.to_s, item_title)] + content_ary
|
95
|
+
scen_title = item_title
|
96
|
+
|
97
|
+
row_hsh[:counter] = feat_counter += 1
|
98
|
+
row_hsh[:s_type] = type == :Scenario ? "S" : "SO"
|
99
|
+
row_hsh[:s_title] = excel_content_format scen_title
|
100
|
+
|
101
|
+
all_tags = [feat_tags_ary, bg_tags_ary, tags_ary].flatten.compact
|
102
|
+
ordered_list, ignore_list, select_list = filter_special_tags(all_tags)
|
103
|
+
row_hsh[:tags] = ordered_list
|
104
|
+
row_hsh[:other_tags] = ignore_list.join ", "
|
105
|
+
row_hsh[:feature_title] = excel_content_format feature_title
|
106
|
+
row_hsh[:bg_title] = excel_content_format bg_title
|
107
|
+
row_hsh[:file_s_num] = in_feat_counter += 1
|
108
|
+
row_hsh[:feature_count] = in_feat_counter == 1 ? 1 : 0
|
109
|
+
row_hsh[:file_name] = file_path
|
110
|
+
|
111
|
+
# row_hsh[:examples] = "" # is nil by default
|
112
|
+
if type == :ScenarioOutline
|
113
|
+
row_hsh[:examples] = example_count example_ary
|
114
|
+
end
|
115
|
+
row_ary = []
|
116
|
+
get_keys_ary(@order).each do |k|
|
117
|
+
if k == :tags
|
118
|
+
# v.each { |tag| row_ary << (tag.nil?? EXCEL_BLANK : tag) }
|
119
|
+
tags_ary = row_hsh[k]
|
120
|
+
tags_ary.each {|tag| row_ary << tag}
|
121
|
+
else
|
122
|
+
row_ary << (row_hsh[k])
|
123
|
+
end
|
124
|
+
end
|
125
|
+
res << row_ary
|
126
|
+
@no_feature_content = false
|
127
|
+
# end
|
128
|
+
# get_keys_ary(@order).each {|k| row_ary << excel_arg_hilight(row_hsh[k])}
|
115
129
|
end
|
116
|
-
res << row_ary
|
117
130
|
end
|
118
|
-
|
131
|
+
|
119
132
|
end
|
133
|
+
|
134
|
+
if @no_feature_content
|
135
|
+
@log.warn "No 'Scenario:' or 'Scenario Outline:' found in file @ #{@file_path}"
|
136
|
+
|
137
|
+
row_hsh = {}
|
138
|
+
feat_counter += 1
|
139
|
+
|
140
|
+
row_hsh[:bg_title] = excel_content_format bg_title
|
141
|
+
row_hsh[:feature_title] = excel_content_format feature_title
|
142
|
+
row_hsh[:file_s_num] = in_feat_counter += 1
|
143
|
+
row_hsh[:feature_count] = in_feat_counter == 1 ? 1 : 0
|
144
|
+
all_tags = [feature_tags_ary, bg_tags_ary].flatten.compact
|
145
|
+
ordered_list, ignore_list, select_list = filter_special_tags(all_tags)
|
146
|
+
row_hsh[:tags] = ordered_list
|
147
|
+
row_hsh[:other_tags] = ignore_list.join ", "
|
148
|
+
|
149
|
+
write_empty_row res, row_hsh, feat_counter, file_path
|
150
|
+
end
|
151
|
+
|
120
152
|
feature_title = []
|
153
|
+
feature_tags_ary = []
|
121
154
|
bg_title = []
|
155
|
+
bg_tags_ary = []
|
156
|
+
|
157
|
+
else
|
158
|
+
# todo: blank feature fill!
|
159
|
+
@log.warn "No 'Feature:' found in file @ #{@file_path}"
|
160
|
+
|
161
|
+
row_hsh = {}
|
162
|
+
feat_counter += 1
|
163
|
+
|
164
|
+
write_empty_row res, row_hsh, feat_counter, file_path
|
122
165
|
end
|
123
166
|
end
|
124
167
|
end
|
@@ -126,6 +169,21 @@ module Cuker
|
|
126
169
|
res
|
127
170
|
end
|
128
171
|
|
172
|
+
def in_feature(hsh)
|
173
|
+
if hsh[:feature]
|
174
|
+
feat = hsh[:feature]
|
175
|
+
|
176
|
+
feat_tags = get_tags feat
|
177
|
+
feat_title = get_title_ary feat
|
178
|
+
|
179
|
+
children = feat[:children]
|
180
|
+
children.each {|child| yield feat_tags, feat_title, child}
|
181
|
+
yield feat_tags, feat_title, nil if children.empty?
|
182
|
+
else
|
183
|
+
@log.warn "No Features found in file @ #{@file_path}"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
129
187
|
def example_count example_ary
|
130
188
|
# [0] title
|
131
189
|
# [1] table = [[0] title [...] examples]
|
@@ -135,6 +193,26 @@ module Cuker
|
|
135
193
|
sum.inject('+')
|
136
194
|
end
|
137
195
|
|
196
|
+
def write_empty_row res, row_hsh, feat_counter, file_path
|
197
|
+
row_hsh[:feature_count] ||= 0
|
198
|
+
row_hsh[:file_s_num] ||= 0
|
199
|
+
row_hsh[:counter] = feat_counter
|
200
|
+
row_hsh[:s_type] = nil
|
201
|
+
row_hsh[:file_name] = file_path
|
202
|
+
row_hsh[:tags] = Array.new(@special_tag_list.size)
|
203
|
+
|
204
|
+
row_ary = []
|
205
|
+
get_keys_ary(@order).each do |k|
|
206
|
+
if k == :tags
|
207
|
+
tags_ary = row_hsh[k]
|
208
|
+
tags_ary.each {|tag| row_ary << tag}
|
209
|
+
else
|
210
|
+
row_ary << (row_hsh[k])
|
211
|
+
end
|
212
|
+
end
|
213
|
+
res << row_ary
|
214
|
+
@no_feature_content = false
|
215
|
+
end
|
138
216
|
end
|
139
217
|
|
140
218
|
end
|
@@ -118,7 +118,14 @@ module Cuker
|
|
118
118
|
row, col = current_row, current_col
|
119
119
|
worksheet.insert_row(row)
|
120
120
|
ary.each do |val|
|
121
|
-
|
121
|
+
case val.class.to_s
|
122
|
+
when "String", "Integer", /Nil/
|
123
|
+
worksheet.insert_cell(row, col, val)
|
124
|
+
else
|
125
|
+
@log.error "SummaryRubyXLFile auto stringification of unknown format: #{val.class} => '#{val}'"
|
126
|
+
worksheet.insert_cell(row, col, val.to_s)
|
127
|
+
# worksheet.insert_cell(row, col, val.to_s)
|
128
|
+
end
|
122
129
|
col += 1
|
123
130
|
end
|
124
131
|
|
Binary file
|
data/lib/cuker/version.rb
CHANGED