hiptest-publisher 0.11.2 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/lib/hiptest-publisher.rb +28 -21
- data/lib/hiptest-publisher/handlebars_helper.rb +9 -0
- data/lib/hiptest-publisher/nodes.rb +15 -0
- data/lib/hiptest-publisher/options_parser.rb +3 -2
- data/lib/hiptest-publisher/renderer.rb +1 -0
- data/lib/hiptest-publisher/signature_differ.rb +12 -0
- data/lib/hiptest-publisher/signature_exporter.rb +7 -1
- data/lib/hiptest-publisher/xml_parser.rb +2 -0
- data/lib/templates/gherkin/single_scenario.hbs +1 -1
- data/lib/templates/robotframework/folder.hbs +6 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaf797bb90915b33c0fcc31a91db0b9c08fc0719
|
4
|
+
data.tar.gz: 5c9da89ee5917ae6dafd57b327489adb97f235b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 484a6f05e90199d760a72ecb04b7afb65d604eb4a2d9e9bcd8caf89f1288868b7654303ace2e55467ecf1b6580139f5519980bda54d82112b27b4c6bee2058e0
|
7
|
+
data.tar.gz: b9aa082407bacefdc575d59129ad50a21ed915311f4cad50710dbe05fce5aa6dad38d9dd74591eedeffe5c429af8f91adfe5c727e297bee333ea357e9fad1f93
|
data/README.md
CHANGED
@@ -95,7 +95,7 @@ Specific options:
|
|
95
95
|
--leafless-export Use only last level action word (default: false)
|
96
96
|
-s, --site=SITE Site to fetch from (default: https://hiptest.net)
|
97
97
|
-p, --push=FILE.TAP Push a results file to the server
|
98
|
-
--push-format=tap Format of the test results (tap, junit, robot) (default: tap)
|
98
|
+
--push-format=tap Format of the test results (tap, junit, nunit, robot) (default: tap)
|
99
99
|
--sort=[id,order,alpha] Sorting of tests in output: id will sort them by age, order will keep the same order than in hiptest (only with --with-folders option, will fallback to id otherwise), alpha will sort them by name (default: order)
|
100
100
|
-v, --verbose Run verbosely (default: false)
|
101
101
|
-H, --languages-help Show languages and framework options
|
@@ -132,12 +132,13 @@ Posting results to Hiptest
|
|
132
132
|
--------------------------
|
133
133
|
|
134
134
|
You can use the options --push to push the results back to Hiptest. For this, you first need to generate the test code from a Test run by specifying option ``--test-run-id=<xxx>`` during code generation (or add it to the configuration file).
|
135
|
-
The tests must then generate a test report that is supported by Hiptest. Currently
|
135
|
+
The tests must then generate a test report that is supported by Hiptest. Currently four types of test results are handled:
|
136
136
|
- tap (Test Anything Protocol)
|
137
|
-
- jUnit XML
|
137
|
+
- jUnit XML format
|
138
|
+
- NUnit XML format
|
138
139
|
- Robot framework XML output
|
139
140
|
|
140
|
-
You can specify the type of export when pushing by using the option "--push-format=[tap|junit|robot]" or specifying it in the config file.
|
141
|
+
You can specify the type of export when pushing by using the option "--push-format=[tap|junit|nunit|robot]" or specifying it in the config file.
|
141
142
|
|
142
143
|
You can push multiple files at once (using wildcard) but in that case, do not forget to add quotes. For examples:
|
143
144
|
|
data/lib/hiptest-publisher.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'colorize'
|
2
|
+
require 'fileutils'
|
2
3
|
require 'json'
|
3
4
|
require 'yaml'
|
4
5
|
|
@@ -159,17 +160,7 @@ module Hiptest
|
|
159
160
|
end
|
160
161
|
|
161
162
|
if @cli_options.aw_created
|
162
|
-
|
163
|
-
|
164
|
-
@language_config.language_group_configs.select { |language_group_config|
|
165
|
-
language_group_config[:group_name] == "actionwords"
|
166
|
-
}.each do |language_group_config|
|
167
|
-
diff[:created].each do |created|
|
168
|
-
node_rendering_context = language_group_config.build_node_rendering_context(created[:node])
|
169
|
-
puts node_rendering_context[:node].render(node_rendering_context)
|
170
|
-
puts ""
|
171
|
-
end
|
172
|
-
end
|
163
|
+
print_updated_aws(diff[:created])
|
173
164
|
return
|
174
165
|
end
|
175
166
|
|
@@ -183,17 +174,12 @@ module Hiptest
|
|
183
174
|
end
|
184
175
|
|
185
176
|
if @cli_options.aw_signature_changed
|
186
|
-
|
177
|
+
print_updated_aws(diff[:signature_changed])
|
178
|
+
return
|
179
|
+
end
|
187
180
|
|
188
|
-
|
189
|
-
|
190
|
-
}.each do |language_group_config|
|
191
|
-
diff[:signature_changed].each do |signature_changed|
|
192
|
-
node_rendering_context = language_group_config.build_node_rendering_context(signature_changed[:node])
|
193
|
-
puts signature_changed[:node].render(node_rendering_context)
|
194
|
-
puts ""
|
195
|
-
end
|
196
|
-
end
|
181
|
+
if @cli_options.aw_definition_changed
|
182
|
+
print_updated_aws(diff[:definition_changed])
|
197
183
|
return
|
198
184
|
end
|
199
185
|
|
@@ -221,6 +207,12 @@ module Hiptest
|
|
221
207
|
puts ""
|
222
208
|
end
|
223
209
|
|
210
|
+
unless diff[:definition_changed].nil?
|
211
|
+
puts "#{pluralize(diff[:definition_changed].length, "action word")} which definition changed:"
|
212
|
+
puts diff[:definition_changed].map {|c| "- #{c[:name]}"}.join("\n")
|
213
|
+
puts ""
|
214
|
+
end
|
215
|
+
|
224
216
|
if diff.empty?
|
225
217
|
puts "No action words changed"
|
226
218
|
puts ""
|
@@ -229,6 +221,21 @@ module Hiptest
|
|
229
221
|
reporter.dump_error(err)
|
230
222
|
end
|
231
223
|
|
224
|
+
def print_updated_aws(actionwords)
|
225
|
+
return if actionwords.nil?
|
226
|
+
|
227
|
+
@language_config.language_group_configs.select { |language_group_config|
|
228
|
+
language_group_config[:group_name] == "actionwords"
|
229
|
+
}.each do |language_group_config|
|
230
|
+
actionwords.each do |actionword|
|
231
|
+
node_rendering_context = language_group_config.build_node_rendering_context(actionword[:node])
|
232
|
+
puts actionword[:node].render(node_rendering_context)
|
233
|
+
puts ""
|
234
|
+
end
|
235
|
+
end
|
236
|
+
return
|
237
|
+
end
|
238
|
+
|
232
239
|
def export
|
233
240
|
return if @project.nil?
|
234
241
|
|
@@ -70,6 +70,15 @@ module Hiptest
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
+
def hh_with(context, var, name, block)
|
74
|
+
name = name.to_s
|
75
|
+
current_value = context.get(name)
|
76
|
+
context.add_item(name, var)
|
77
|
+
result = block.fn(context)
|
78
|
+
context.add_item(name, current_value)
|
79
|
+
result
|
80
|
+
end
|
81
|
+
|
73
82
|
def hh_unless(context, condition, block, else_block = nil)
|
74
83
|
condition = !condition.empty? if condition.respond_to?(:empty?)
|
75
84
|
|
@@ -69,11 +69,26 @@ module Hiptest
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
+
def flat_string
|
73
|
+
flat_childs = children.map do |key, value|
|
74
|
+
"#{key}: #{flatten_child(value)}"
|
75
|
+
end.join(", ")
|
76
|
+
"<#{self.class.name} [#{flat_childs}]>"
|
77
|
+
end
|
78
|
+
|
72
79
|
private
|
73
80
|
|
74
81
|
def node_kinds
|
75
82
|
@@node_kinds ||= {}
|
76
83
|
end
|
84
|
+
|
85
|
+
def flatten_child(child)
|
86
|
+
return child.flat_string if child.is_a?(Node)
|
87
|
+
if child.is_a?(Array)
|
88
|
+
return child.map {|item| flatten_child(item)}
|
89
|
+
end
|
90
|
+
child.to_s
|
91
|
+
end
|
77
92
|
end
|
78
93
|
|
79
94
|
class Literal < Node
|
@@ -73,7 +73,7 @@ class CliOptions < OpenStruct
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def actionwords_diff?
|
76
|
-
actionwords_diff || aw_deleted || aw_created || aw_renamed || aw_signature_changed
|
76
|
+
actionwords_diff || aw_deleted || aw_created || aw_renamed || aw_signature_changed || aw_definition_changed
|
77
77
|
end
|
78
78
|
|
79
79
|
def language_framework
|
@@ -160,12 +160,13 @@ class OptionsParser
|
|
160
160
|
Option.new(nil, 'show-actionwords-created', false, nil, "Output code for new action words", :aw_created),
|
161
161
|
Option.new(nil, 'show-actionwords-renamed', false, nil, "Output signatures of renamed action words", :aw_renamed),
|
162
162
|
Option.new(nil, 'show-actionwords-signature-changed', false, nil, "Output signatures of action words for which signature changed", :aw_signature_changed),
|
163
|
+
Option.new(nil, 'show-actionwords-definition-changed', false, nil, "Output action words for which definition changed", :aw_definition_changed),
|
163
164
|
Option.new(nil, 'with-folders', false, nil, "Use folders hierarchy to export files in respective directories", :with_folders),
|
164
165
|
Option.new(nil, 'split-scenarios', false, nil, "Export each scenario in a single file", :split_scenarios),
|
165
166
|
Option.new(nil, 'leafless-export', false, nil, "Use only last level action word", :leafless_export),
|
166
167
|
Option.new('s', 'site=SITE', 'https://hiptest.net', String, "Site to fetch from", :site),
|
167
168
|
Option.new('p', 'push=FILE.TAP', '', String, "Push a results file to the server", :push),
|
168
|
-
Option.new(nil, 'push-format=tap', 'tap', String, "Format of the test results (tap, junit, robot)", :push_format),
|
169
|
+
Option.new(nil, 'push-format=tap', 'tap', String, "Format of the test results (tap, junit, nunit, robot)", :push_format),
|
169
170
|
Option.new(nil, 'sort=[id,order,alpha]', 'order', String, "Sorting of tests in output: id will sort them by age, order will keep the same order than in hiptest (only with --with-folders option, will fallback to id otherwise), alpha will sort them by name", :sort),
|
170
171
|
Option.new('v', 'verbose', false, nil, "Run verbosely", :verbose)
|
171
172
|
]
|
@@ -33,6 +33,7 @@ module Hiptest
|
|
33
33
|
@rendered_children[:splitted_scenarios] = node.children[:scenarios].map {|sc|
|
34
34
|
{
|
35
35
|
name: @rendered[sc.children[:name]],
|
36
|
+
tags: sc.children[:tags].map {|tag| @rendered[tag]},
|
36
37
|
uid: @rendered[sc.children[:uid]],
|
37
38
|
datatable: @rendered[sc.children[:datatable]],
|
38
39
|
datasets: sc.children[:datatable].children[:datasets].map {|dataset|
|
@@ -17,12 +17,14 @@ module Hiptest
|
|
17
17
|
compute_deleted
|
18
18
|
compute_renamed
|
19
19
|
compute_signature_changed
|
20
|
+
compute_definition_changed
|
20
21
|
|
21
22
|
diff = {}
|
22
23
|
diff[:created] = @created unless @created.empty?
|
23
24
|
diff[:deleted] = @deleted unless @deleted.empty?
|
24
25
|
diff[:renamed] = @renamed unless @renamed.empty?
|
25
26
|
diff[:signature_changed] = @signature_changed unless @signature_changed.empty?
|
27
|
+
diff[:definition_changed] = @definition_changed unless @definition_changed.empty?
|
26
28
|
|
27
29
|
diff
|
28
30
|
end
|
@@ -57,6 +59,16 @@ module Hiptest
|
|
57
59
|
end.compact
|
58
60
|
end
|
59
61
|
|
62
|
+
def compute_definition_changed
|
63
|
+
@definition_changed = @current_uid.map do |uid, aw|
|
64
|
+
next if @old_uid[uid].nil?
|
65
|
+
next unless @old_uid[uid].has_key?('body_hash')
|
66
|
+
next if aw['body_hash'] == @old_uid[uid]['body_hash']
|
67
|
+
|
68
|
+
{name: aw['name'], node: aw['node']}
|
69
|
+
end.compact
|
70
|
+
end
|
71
|
+
|
60
72
|
def map_by_uid(actionwords)
|
61
73
|
Hash[actionwords.collect { |aw| [aw['uid'], aw] }]
|
62
74
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'digest/md5'
|
2
3
|
|
3
4
|
module Hiptest
|
4
5
|
class SignatureExporter
|
@@ -15,7 +16,8 @@ module Hiptest
|
|
15
16
|
hash = {
|
16
17
|
'name' => item.children[:name],
|
17
18
|
'uid' => item.children[:uid],
|
18
|
-
'parameters' => export_parameters(item)
|
19
|
+
'parameters' => export_parameters(item),
|
20
|
+
'body_hash' => make_body_hash(item.children[:body])
|
19
21
|
}
|
20
22
|
hash['node'] = item if export_node
|
21
23
|
hash
|
@@ -32,5 +34,9 @@ module Hiptest
|
|
32
34
|
'name' => parameter.children[:name]
|
33
35
|
}
|
34
36
|
end
|
37
|
+
|
38
|
+
def make_body_hash(body)
|
39
|
+
Digest::MD5.hexdigest(body.map(&:flat_string).join(''))
|
40
|
+
end
|
35
41
|
end
|
36
42
|
end
|
@@ -219,6 +219,8 @@ module Hiptest
|
|
219
219
|
if datasets.empty?
|
220
220
|
scenario.set_uid(css_first_content(scs, 'testSnapshot > uid'))
|
221
221
|
else
|
222
|
+
scenario.set_uid(css_first_content(scs, ' > uid'))
|
223
|
+
|
222
224
|
scs.css('testSnapshot').each do |testSnapshot|
|
223
225
|
uid = css_first_content(testSnapshot, '> uid')
|
224
226
|
index = css_first_content(testSnapshot, '> index').to_i
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{{#if has_datasets?}}
|
2
2
|
{{#if has_tags?}}{{join rendered_children.tags ' '}}
|
3
|
-
{{/if}}Scenario Outline: {{{ rendered_children.name }}}{{#indent}}
|
3
|
+
{{/if}}Scenario Outline: {{{ rendered_children.name }}}{{#if rendered_children.uid}} (uid:{{{rendered_children.uid}}}){{/if}}{{#indent}}
|
4
4
|
{{#each rendered_children.body}}{{{ this }}}
|
5
5
|
{{/each}}
|
6
6
|
Examples:{{#indent}}
|
@@ -10,15 +10,17 @@ Resource keywords.txt
|
|
10
10
|
Test Setup{{tab}}Run Keywords{{tab}}{{join rendered_children.body "\n... AND \t"}}
|
11
11
|
{{/unless}}
|
12
12
|
*** Test Cases ***{{#if datatables_present?}}
|
13
|
-
{{#each rendered_children.splitted_scenarios}}
|
13
|
+
{{#each rendered_children.splitted_scenarios}}{{#with this.tags "tags"}}
|
14
14
|
{{#if this.datatable}}{{#each this.datasets}}{{normalize_with_spaces this.scenario_name}} {{normalize_with_spaces this.name}}{{#if this.uid}} (uid:{{normalize this.uid}}){{/if}}{{#indent}}
|
15
|
-
[
|
15
|
+
{{#if tags}}[Tags]{{tab}}{{{join tags "\t"}}}
|
16
|
+
{{/if}}[Template]{{tab}}{{normalize_with_spaces this.scenario_name}} keyword
|
16
17
|
{{join this.arguments '\t'}}{{/indent}}
|
17
18
|
|
18
19
|
{{/each}}
|
19
20
|
{{else}}{{normalize_with_spaces this.name}}{{#if this.uid}}(uid:{{normalize this.uid}}){{/if}}{{#indent}}
|
20
|
-
{{join this.
|
21
|
-
{{/if}}{{/
|
21
|
+
{{#if this.tags}}[Tags]{{tab}}{{{join this.tags "\t"}}}
|
22
|
+
{{/if}}{{join this.body '\n'}}{{/indent}}
|
23
|
+
{{/if}}{{/with}}{{/each}}
|
22
24
|
*** Keywords ***
|
23
25
|
|
24
26
|
{{#each rendered_children.splitted_scenarios}}{{#if this.datatable}}{{normalize_with_spaces this.name}} keyword{{#indent}}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiptest-publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiptest R&D
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|