hiptest-publisher 1.19.3 → 1.20.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 +10 -10
- data/lib/hiptest-publisher.rb +3 -3
- data/lib/hiptest-publisher/cli_options_checker.rb +21 -2
- data/lib/hiptest-publisher/client.rb +1 -1
- data/lib/hiptest-publisher/formatters/console_formatter.rb +1 -1
- data/lib/hiptest-publisher/options_parser.rb +22 -4
- data/lib/templates/gherkin/scenarios.hbs +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f866fbfa2e3015b67eb9393099403394457cf9f4b17932df59ada6b5a8942ba9
|
4
|
+
data.tar.gz: 7f0c99647bd42c3a08b803c13f5679233cfd32a2354f4dbe19128ef89bc2cc0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e118cbccabea2ca7d845d9fd94a206c3f29547a61019165f70ca6216f0db3479fec8cf38b6359dca9ff43762e0963ab69857bcc59819b2a958654ccd7f527cf7
|
7
|
+
data.tar.gz: 0edc4eaec30b1041d4113616a0de356056d6b05a2d1fe9601c4eb33cfc5a781ef2193acc7aeb9b28fb6d6ffc4a18365ca2836f1d5c7e7cb54fe0bbd7c77fc017
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
HipTest Publisher
|
2
2
|
==============
|
3
3
|
|
4
4
|
[![Build Status Linux](https://travis-ci.org/hiptest/hiptest-publisher.svg?branch=master)](https://travis-ci.org/hiptest/hiptest-publisher)
|
@@ -44,7 +44,7 @@ Note: for Windows users, take a look at [this Windows installation guide](docs/I
|
|
44
44
|
Exporting a project
|
45
45
|
-------------------
|
46
46
|
|
47
|
-
Go to one of your [
|
47
|
+
Go to one of your [HipTest projects](https://app.hiptest.com/projects) and select the Settings tab.
|
48
48
|
This tab is available only for projects you own.
|
49
49
|
From there, copy the secret token and run this command line:
|
50
50
|
|
@@ -91,7 +91,7 @@ hiptest-publisher --help
|
|
91
91
|
You could obtain for example:
|
92
92
|
|
93
93
|
```shell
|
94
|
-
Exports tests from
|
94
|
+
Exports tests from HipTest for automation.
|
95
95
|
|
96
96
|
Specific options:
|
97
97
|
-t, --token=TOKEN Secret token (available in your project settings)
|
@@ -105,7 +105,7 @@ Specific options:
|
|
105
105
|
--test-run-name=NAME Export data from a test run identified by its name
|
106
106
|
--only=CATEGORIES Restrict export to given file categories (--only=list to list them)
|
107
107
|
--without=CATEGORIES Exclude file categories from import (--only=list to list them)
|
108
|
-
-x, --xml-file=PROJECT_XML XML file to use instead of fetching it from
|
108
|
+
-x, --xml-file=PROJECT_XML XML file to use instead of fetching it from HipTest
|
109
109
|
--tests-only (deprecated) alias for --only=tests (default: false)
|
110
110
|
--actionwords-only (deprecated) alias for --only=actionwords (default: false)
|
111
111
|
--actionwords-signature Export actionwords signature (default: false)
|
@@ -129,13 +129,13 @@ Specific options:
|
|
129
129
|
--global-failure-on-missing-reports
|
130
130
|
When there is no results file to push, report a global failure (default: false)
|
131
131
|
--push-format=tap Format of the test results (cucumber-json, junit, nunit, robot, tap) (default: tap)
|
132
|
-
--sort=[id,order,alpha] Sorting of tests in output: id will sort them by age, order will keep the same order than in
|
132
|
+
--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)
|
133
133
|
--[no-]uids Export UIDs (note: can be disabled only for Gherkin-based exports, may cause issue when pushing results back) (default: true)
|
134
134
|
--[no-]parent-folders-tags Export tags from parent folder (note: if set to false, those tags are never rendered. Only available for Gherkin base exports) (default: true)
|
135
135
|
--parameter-delimiter Parameter delimiter (for Gherkin based export only) (default: ")
|
136
136
|
--with-dataset-names Export dataset name when creating feature files (note: available only for Gherkin-based exports) (default: false)
|
137
|
-
--keep-filenames Keep the same name as in
|
138
|
-
--keep-foldernames Keep the same name as in
|
137
|
+
--keep-filenames Keep the same name as in HipTest for the test files (note: may cause encoding issues) (default: false)
|
138
|
+
--keep-foldernames Keep the same name as in HipTest for the folders (note: may cause encoding issues) (default: false)
|
139
139
|
--filter-on-scenario-ids=IDS Filter on scenario ids (use commas to separate ids when fetching multiple scenarios)
|
140
140
|
--filter-on-folder-ids=IDS Filter on folder ids (use commas to separate ids when fetching multiple folders)
|
141
141
|
--filter-on-scenario-name=NAME
|
@@ -187,11 +187,11 @@ If username and password are required:
|
|
187
187
|
http_proxy=http://<username>:<password>@<proxy_host>:<proxy_port>
|
188
188
|
```
|
189
189
|
|
190
|
-
Posting results to
|
190
|
+
Posting results to HipTest
|
191
191
|
--------------------------
|
192
192
|
|
193
|
-
You can use the options --push to push the results back to
|
194
|
-
The tests must then generate a test report that is supported by
|
193
|
+
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).
|
194
|
+
The tests must then generate a test report that is supported by HipTest. Currently four types of test results are handled:
|
195
195
|
- jUnit XML format
|
196
196
|
- [NUnit XML v2 format](https://github.com/nunit/docs/wiki/XML-Formats#v2-test-results)
|
197
197
|
- [TAP (Test Anything Protocol)](https://testanything.org/)
|
data/lib/hiptest-publisher.rb
CHANGED
@@ -82,7 +82,7 @@ module Hiptest
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def fetch_xml_file
|
85
|
-
reporter.with_status_message "Fetching data from
|
85
|
+
reporter.with_status_message "Fetching data from HipTest" do
|
86
86
|
@client.fetch_project_export
|
87
87
|
end
|
88
88
|
rescue ClientError => err
|
@@ -277,11 +277,11 @@ module Hiptest
|
|
277
277
|
end
|
278
278
|
|
279
279
|
def report_hiptest_api_error(response)
|
280
|
-
reporter.failure_message("
|
280
|
+
reporter.failure_message("HipTest API returned error #{response.code}")
|
281
281
|
if response.code == "422" && response.body.start_with?("Unknown format")
|
282
282
|
STDERR.print response.body.chomp + "\n"
|
283
283
|
elsif response.code == "404"
|
284
|
-
STDERR.print "Did you specify the project token of an existing
|
284
|
+
STDERR.print "Did you specify the project token of an existing HipTest project?\n"
|
285
285
|
end
|
286
286
|
end
|
287
287
|
|
@@ -23,6 +23,7 @@ module Hiptest
|
|
23
23
|
check_secret_token
|
24
24
|
check_filters
|
25
25
|
check_status_filter
|
26
|
+
check_meta
|
26
27
|
|
27
28
|
if cli_options.push?
|
28
29
|
check_push_file
|
@@ -90,7 +91,7 @@ module Hiptest
|
|
90
91
|
raise CliOptionError, [
|
91
92
|
"Missing argument --token: you must specify project secret token with --token=<project-token>",
|
92
93
|
"",
|
93
|
-
"The project secret token can be found on
|
94
|
+
"The project secret token can be found on HipTest in the settings section, under",
|
94
95
|
"'Publication settings'. It is a sequence of numbers uniquely identifying your",
|
95
96
|
"project.",
|
96
97
|
"",
|
@@ -193,13 +194,27 @@ module Hiptest
|
|
193
194
|
next if tag_compatible?(val.strip)
|
194
195
|
|
195
196
|
raise CliOptionError, [
|
196
|
-
"#{option_name} should be a list of comma separated tags in
|
197
|
+
"#{option_name} should be a list of comma separated tags in HipTest",
|
197
198
|
"",
|
198
199
|
"Found: #{val.strip.inspect}"
|
199
200
|
].join("\n")
|
200
201
|
end
|
201
202
|
end
|
202
203
|
|
204
|
+
def check_meta
|
205
|
+
value = cli_options.meta
|
206
|
+
return if absent?(value)
|
207
|
+
|
208
|
+
value.split(',').each do |val|
|
209
|
+
next if meta_compatible?(val.strip)
|
210
|
+
|
211
|
+
raise CliOptionError, [
|
212
|
+
"meta should be a list of comma separated key:value items (eg. OS:Linux,CI:Jenkins)",
|
213
|
+
"",
|
214
|
+
"Found: #{val.strip.inspect}"
|
215
|
+
].join("\n")
|
216
|
+
end end
|
217
|
+
|
203
218
|
def check_language_and_only
|
204
219
|
if present?(cli_options.language)
|
205
220
|
begin
|
@@ -249,6 +264,10 @@ module Hiptest
|
|
249
264
|
value =~ /\A[a-zA-Z0-9_-]*(: ?[a-zA-Z0-9_-]*)?\z/
|
250
265
|
end
|
251
266
|
|
267
|
+
def meta_compatible?(value)
|
268
|
+
value =~ /\A[a-zA-Z0-9_-]*: ?[a-zA-Z0-9_-]*\z/
|
269
|
+
end
|
270
|
+
|
252
271
|
def formatted_categories(categories)
|
253
272
|
formatted_categories = categories.map(&:inspect)
|
254
273
|
if formatted_categories.length == 1
|
@@ -122,7 +122,7 @@ module Hiptest
|
|
122
122
|
if cli_options.test_run_id?
|
123
123
|
cli_options.test_run_id
|
124
124
|
else
|
125
|
-
raise ClientError, "Cannot get the list of available test runs from
|
125
|
+
raise ClientError, "Cannot get the list of available test runs from HipTest. Try using --test-run-id instead of --test-run-name"
|
126
126
|
end
|
127
127
|
else
|
128
128
|
matching_test_run = available_test_runs.find { |test_run| test_run[key] == searched_value }
|
@@ -21,7 +21,7 @@ class ConsoleFormatter
|
|
21
21
|
|
22
22
|
def show_options(options, message = nil)
|
23
23
|
return unless verbose
|
24
|
-
message ||= "Running
|
24
|
+
message ||= "Running hiptest-publisher #{hiptest_publisher_version} with:"
|
25
25
|
puts message.yellow
|
26
26
|
options.each { |k, v| puts " - #{k}: #{v.inspect}" }
|
27
27
|
end
|
@@ -217,7 +217,7 @@ class OptionsParser
|
|
217
217
|
Option.new(nil, 'test-run-name=NAME', '', String, "Export data from a test run identified by its name", :test_run_name),
|
218
218
|
Option.new(nil, 'only=CATEGORIES', nil, String, "Restrict export to given file categories (--only=list to list them)", :only),
|
219
219
|
Option.new(nil, 'without=CATEGORIES', nil, String, "Exclude file categories from import (--only=list to list them)", :without),
|
220
|
-
Option.new('x', 'xml-file=PROJECT_XML', nil, String, "XML file to use instead of fetching it from
|
220
|
+
Option.new('x', 'xml-file=PROJECT_XML', nil, String, "XML file to use instead of fetching it from HipTest", :xml_file),
|
221
221
|
Option.new(nil, 'tests-only', false, nil, "(deprecated) alias for --only=tests", :tests_only),
|
222
222
|
Option.new(nil, 'actionwords-only', false, nil, "(deprecated) alias for --only=actionwords", :actionwords_only),
|
223
223
|
Option.new(nil, 'actionwords-signature', false, nil, "Export actionwords signature", :actionwords_signature),
|
@@ -242,8 +242,8 @@ class OptionsParser
|
|
242
242
|
Option.new(nil, '[no-]parent-folder-tags', true, nil, 'Export tags from parent folders (note: if set to false, those tags are never rendered. Only available for Gherkin base exports)', :parent_folder_tags),
|
243
243
|
Option.new(nil, 'parameter-delimiter', '"', String, 'Parameter delimiter (for Gherkin based export only)', :parameter_delimiter),
|
244
244
|
Option.new(nil, 'with-dataset-names', false, nil, 'Export dataset name when creating feature files (note: available only for Gherkin-based exports)', :with_dataset_names),
|
245
|
-
Option.new(nil, 'keep-filenames', false, nil, "Keep the same name as in
|
246
|
-
Option.new(nil, 'keep-foldernames', false, nil, "Keep the same name as in
|
245
|
+
Option.new(nil, 'keep-filenames', false, nil, "Keep the same name as in HipTest for the test files (note: may cause encoding issues)", :keep_filenames),
|
246
|
+
Option.new(nil, 'keep-foldernames', false, nil, "Keep the same name as in HipTest for the folders (note: may cause encoding issues)", :keep_foldernames),
|
247
247
|
Option.new(nil, 'filter-on-scenario-ids=IDS', '', String, "Filter on scenario ids (use commas to separate ids when fetching multiple scenarios)", :filter_on_scenario_ids),
|
248
248
|
Option.new(nil, 'filter-on-folder-ids=IDS', '', String, "Filter on folder ids (use commas to separate ids when fetching multiple folders)", :filter_on_folder_ids),
|
249
249
|
Option.new(nil, 'filter-on-scenario-name=NAME', '', String, "Filter on scenario name (only one name is accepted)", :filter_on_scenario_name),
|
@@ -251,6 +251,7 @@ class OptionsParser
|
|
251
251
|
Option.new(nil, 'filter-on-tags=TAGS', '', String, "Filter on scenarios and folder tags (use commas to separate tags when using multiple tags)", :filter_on_tags),
|
252
252
|
Option.new(nil, 'filter-on-status=STATUS', '', String, "Filter on test status in last build (use in conjunction with a test run)", :filter_on_status),
|
253
253
|
Option.new(nil, 'not-recursive', false, nil, "Used in conjunction with filter-on-folder-ids or filter-on-folder-name: only exports those folders, not their children", :not_recursive),
|
254
|
+
Option.new(nil, 'meta=META', '', String, "Meta informations that can be used for customizing templates", :meta),
|
254
255
|
Option.new(nil, 'check-version', false, nil, "Check if a new release of hiptest-publisher is available", :check_version),
|
255
256
|
Option.new(nil, 'force', false, nil, "Force overwrite of existing files (do not apply to test files)", :force_overwrite),
|
256
257
|
Option.new('v', 'verbose', false, nil, "Run verbosely", :verbose)
|
@@ -263,7 +264,7 @@ class OptionsParser
|
|
263
264
|
opts.version = hiptest_publisher_version if hiptest_publisher_version
|
264
265
|
opts.banner = "Usage: ruby publisher.rb [options]"
|
265
266
|
opts.separator ""
|
266
|
-
opts.separator "Exports tests from
|
267
|
+
opts.separator "Exports tests from HipTest for automation."
|
267
268
|
opts.separator ""
|
268
269
|
opts.separator "Specific options:"
|
269
270
|
|
@@ -566,6 +567,7 @@ class LanguageGroupConfig
|
|
566
567
|
node: node,
|
567
568
|
call_prefix: @language_group_params[:call_prefix],
|
568
569
|
package: @language_group_params[:package],
|
570
|
+
meta: @language_group_params[:meta],
|
569
571
|
parameter_delimiter: @user_params[:parameter_delimiter],
|
570
572
|
namespace: @language_group_params[:namespace],
|
571
573
|
uids: @user_params[:uids],
|
@@ -700,6 +702,21 @@ class LanguageConfigParser
|
|
700
702
|
name.send(get_key_from_group('actionwords', 'naming_convention'))
|
701
703
|
end
|
702
704
|
|
705
|
+
def meta
|
706
|
+
treated = {}
|
707
|
+
meta_opt = @cli_options.meta || ""
|
708
|
+
|
709
|
+
meta_opt.split(',').each do |m|
|
710
|
+
key, value = m.split(':')
|
711
|
+
value = true if value == 'true'
|
712
|
+
value = false if value == 'false'
|
713
|
+
|
714
|
+
treated[key.strip] = value
|
715
|
+
end
|
716
|
+
|
717
|
+
treated
|
718
|
+
end
|
719
|
+
|
703
720
|
private
|
704
721
|
|
705
722
|
def get_key_from_group(group, key)
|
@@ -719,6 +736,7 @@ class LanguageConfigParser
|
|
719
736
|
# List of options that can be set in the config file but not in command line
|
720
737
|
non_visible_options = {
|
721
738
|
package: @cli_options.package,
|
739
|
+
meta: meta,
|
722
740
|
namespace: @cli_options.namespace,
|
723
741
|
test_export_dir: @cli_options.test_export_dir,
|
724
742
|
tests_ouput_dir: @cli_options.tests_ouput_dir,
|
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: 1.
|
4
|
+
version: 1.20.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: 2019-
|
11
|
+
date: 2019-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -667,5 +667,5 @@ rubyforge_project:
|
|
667
667
|
rubygems_version: 2.7.6
|
668
668
|
signing_key:
|
669
669
|
specification_version: 4
|
670
|
-
summary: Export your tests from
|
670
|
+
summary: Export your tests from HipTest into executable tests.
|
671
671
|
test_files: []
|