assertthat-bdd 1.6.0 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/assertthat-bdd-features +2 -2
- data/bin/assertthat-bdd-report +3 -2
- data/lib/assertthat-bdd.rb +13 -21
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b36d65ebbb9b241942bf78871959da8f254fa4e1e90f27186693526f09a35e90
|
4
|
+
data.tar.gz: 753ec600d188310b6fea5bbc84543489b25ea7aed727e1b7735ffd8df8551775
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 453a1604b2ccf676ceae5fbe51e93129fa29f13424cfdff9ae1f8c26e2b58ff35e1fc6c6d5547e8adee0c7548a8ff6650e9417f8bbcd8713baa7e5d67376d9c3
|
7
|
+
data.tar.gz: 7c8176cf0a4881470a0a04c25cacdee7468a4cbd958e10017ae6f55c299976e8a29b20cea58d2e4aff951c5a5641f1976507a1ba79d7e07d614c6a27d056c9e5
|
data/bin/assertthat-bdd-features
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'assertthat-bdd'
|
3
3
|
require 'optparse'
|
4
4
|
|
5
|
-
VERSION = '1.2
|
5
|
+
VERSION = '1.6.2'
|
6
6
|
|
7
7
|
options = {}
|
8
8
|
OptionParser.new do |opt|
|
@@ -27,7 +27,7 @@ end.parse!
|
|
27
27
|
|
28
28
|
raise OptionParser::MissingArgument, "'projectId' option is not specified" if options[:projectId].nil?
|
29
29
|
|
30
|
-
AssertThatBDD::Features.download(options)
|
30
|
+
AssertThatBDD::Features.download(**options)
|
31
31
|
|
32
32
|
|
33
33
|
|
data/bin/assertthat-bdd-report
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'assertthat-bdd'
|
3
3
|
require 'optparse'
|
4
4
|
|
5
|
-
VERSION = '1.2
|
5
|
+
VERSION = '1.6.2'
|
6
6
|
|
7
7
|
options = {}
|
8
8
|
OptionParser.new do |opt|
|
@@ -13,6 +13,7 @@ OptionParser.new do |opt|
|
|
13
13
|
opt.on('-n','--runName RUN_NAME', 'The name of the run - default \'Test run dd MMM yyyy HH:mm:ss\'') { |o| options[:runName] = o }
|
14
14
|
opt.on('-f','--jsonReportFolder JSON_FOLDER_PATH', 'Json report folder - default ./reports') { |o| options[:mode] = o }
|
15
15
|
opt.on('-i','--jsonReportIncludePattern INCLUDE_REGEX', 'Regex to search for cucumber reports - default .*.json') { |o| options[:jql] = o }
|
16
|
+
opt.on('-j','--jql JQL_FILTER', 'Jql issues filter to update with results') { |o| options[:jql] = o }
|
16
17
|
opt.on('-x','--proxy PROXY_URL', 'proxy url to connect to Jira') { |o| options[:proxy] = o }
|
17
18
|
opt.on_tail('-h', '--help', 'Show help') do
|
18
19
|
puts opt
|
@@ -26,6 +27,6 @@ end.parse!
|
|
26
27
|
|
27
28
|
raise OptionParser::MissingArgument, "'projectId' option is not specified" if options[:projectId].nil?
|
28
29
|
|
29
|
-
AssertThatBDD::Report.upload(options)
|
30
|
+
AssertThatBDD::Report.upload(**options)
|
30
31
|
|
31
32
|
|
data/lib/assertthat-bdd.rb
CHANGED
@@ -10,8 +10,18 @@ module AssertThatBDD
|
|
10
10
|
url = ['https://bdd.assertthat.app/rest/api/1/project/', projectId, '/features'].map(&:to_s).join('')
|
11
11
|
url = [jiraServerUrl,"/rest/assertthat/latest/project/",projectId,"/client/features"].map(&:to_s).join('') unless jiraServerUrl.nil?
|
12
12
|
resource = RestClient::Resource.new(url, :user => accessKey, :password => secretKey, :content_type => 'application/zip')
|
13
|
-
begin
|
14
13
|
resource.get(:accept => 'application/zip', params: {mode: mode, jql: jql, tags: tags}) do |response, request, result|
|
14
|
+
case response.code
|
15
|
+
when 401
|
16
|
+
puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
|
17
|
+
return
|
18
|
+
when 400
|
19
|
+
puts '*** ERROR: ' + e.response
|
20
|
+
return
|
21
|
+
when 500
|
22
|
+
puts '*** ERROR: Jira server error (500)'
|
23
|
+
return
|
24
|
+
end
|
15
25
|
Dir.mkdir("#{outputFolder}") unless File.exists?("#{outputFolder}")
|
16
26
|
File.open("#{outputFolder}/features.zip", 'wb') {|f| f.write(response) }
|
17
27
|
features_count = 0
|
@@ -27,31 +37,13 @@ module AssertThatBDD
|
|
27
37
|
puts "*** INFO: #{features_count} features downloaded"
|
28
38
|
end
|
29
39
|
File.delete("#{outputFolder}/features.zip")
|
30
|
-
rescue => e
|
31
|
-
|
32
|
-
if e.respond_to?('response') then
|
33
|
-
if e.response.respond_to?('code') then
|
34
|
-
case e.response.code
|
35
|
-
when 401
|
36
|
-
puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
|
37
|
-
when 400
|
38
|
-
puts '*** ERROR: ' + e.response
|
39
|
-
when 500
|
40
|
-
puts '*** ERROR: Jira server error (500)'
|
41
|
-
end
|
42
|
-
end
|
43
|
-
else
|
44
|
-
puts '*** ERROR: Failed download features: ' + e.message
|
45
|
-
end
|
46
|
-
return
|
47
|
-
end
|
48
40
|
end
|
49
41
|
end
|
50
42
|
end
|
51
43
|
end
|
52
44
|
|
53
45
|
class Report
|
54
|
-
def self.upload(accessKey: ENV['ASSERTTHAT_ACCESS_KEY'], secretKey: ENV['ASSERTTHAT_ACCESS_KEY'], projectId: nil, runName: 'Test run '+Time.now.strftime("%d %b %Y %H:%M:%S"), jsonReportFolder: './reports', jsonReportIncludePattern: '.*.json', jiraServerUrl: nil )
|
46
|
+
def self.upload(accessKey: ENV['ASSERTTHAT_ACCESS_KEY'], secretKey: ENV['ASSERTTHAT_ACCESS_KEY'], projectId: nil, runName: 'Test run '+Time.now.strftime("%d %b %Y %H:%M:%S"), jsonReportFolder: './reports', jsonReportIncludePattern: '.*.json', jql: nil ,jiraServerUrl: nil )
|
55
47
|
url = "https://bdd.assertthat.app/rest/api/1/project/" + projectId + "/report"
|
56
48
|
url = jiraServerUrl+"/rest/assertthat/latest/project/"+projectId+"/client/report" unless jiraServerUrl.nil?
|
57
49
|
files = Find.find(jsonReportFolder).grep(/#{jsonReportIncludePattern}/)
|
@@ -68,7 +60,7 @@ module AssertThatBDD
|
|
68
60
|
:multipart => true,
|
69
61
|
:file => File.new(f, 'rb')
|
70
62
|
},
|
71
|
-
:headers => { :params =>{:runName => runName, :runId=> runId}}
|
63
|
+
:headers => { :params =>{:runName => runName, :runId=> runId, :jql=> jql}}
|
72
64
|
)
|
73
65
|
begin
|
74
66
|
response = request.execute
|