assertthat-bdd 1.4.0 → 1.5.0

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: 713c7de6c2c8f244ec1f5839c3708ccaad3ce9f5e5eaf7d717457da9cca24be2
4
- data.tar.gz: 612e19f5a6d1c1610d1e0f31e71a033a06cfd29b92dd373ab8602a80135b61e1
3
+ metadata.gz: 4e15b2d3b006bf3f512e0500d0010f24a60334b73de44778f2a56d1d77cf1a58
4
+ data.tar.gz: 5c7a16d25c2944e5c9805fc9034aab2665d79a028e2cab2cd9dd45e5f9d42b2c
5
5
  SHA512:
6
- metadata.gz: e50822e3c93b59a4ea7ad94ca4b512766ca54af8c3d69b8c4c51bb7f52f93a6cef3040c746f9c317f1253a055e24c56164945b68af07d74e72fc73b960c7153b
7
- data.tar.gz: 6591ab7cc79a5366baf14950edfb5a27dc95aa23adf841b094c20cc10541d51a26df8ec74b57cd65fa329f426f5506d059b01fbf08f7e69a85e9ac668d83d7b6
6
+ metadata.gz: db72766225400afb9e6fdcef3fb477b766d7cfe612be5e9252d24e95e84eff9ab5ed9237c92e4f0e67c0ba476f0f845a5eb4edb25d711c5d23c06a7d68d9eaf4
7
+ data.tar.gz: 1d62e0b8393dcead620285101149a3f4aa3b21f09f07f910a10df0d01840c72dccda38b5817f2b078b700700111980c4ed0be3b1d84b85439a51be43397d262c
@@ -1,33 +1,33 @@
1
- #!/usr/bin/env ruby
2
- require 'assertthat-bdd'
3
- require 'optparse'
4
-
5
- VERSION = '1.2.0'
6
-
7
- options = {}
8
- OptionParser.new do |opt|
9
- opt.on('-a','--accessKey ACCESS_KEY', 'Access key same as env variable ASSERTTHAT_ACCESS_KEY') { |o| options[:accessKey] = o }
10
- opt.on('-s','--secretKey SECRET_KEY', 'Secret key same as env variable ASSERTTHAT_SECRET_KEY') { |o| options[:secretKey] = o }
11
- opt.on('-u','--jiraServerUrl SERVER_URL', 'Jira server URL') { |o| options[:jiraServerUrl] = o }
12
- opt.on('-p','--projectId PROJECT_ID', 'Jira project id') { |o| options[:projectId] = o }
13
- opt.on('-o','--outputFolder OUTPUT_FOLDER', 'Featured output folder - default ./features') { |o| options[:outputFolder] = o }
14
- opt.on('-m','--mode MODE', 'Mode one of automated,manual,both - deafult automated') { |o| options[:mode] = o }
15
- opt.on('-t','--tags <tag-expression>', 'Cucucmber tag expression for scenarios filtering') { |o| options[:tags] = o }
16
- opt.on('-j','--jql JQL_FILTER', 'Jql issues filter') { |o| options[:jql] = o }
17
- opt.on('-x','--proxy PROXY_URL', 'proxy url to connect to Jira') { |o| options[:proxy] = o }
18
- opt.on_tail('-h', '--help', 'Show help') do
19
- puts opt
20
- exit
21
- end
22
- opt.on_tail('-v','--version', 'Show version') do
23
- puts VERSION
24
- exit
25
- end
26
- end.parse!
27
-
28
- raise OptionParser::MissingArgument, "'projectId' option is not specified" if options[:projectId].nil?
29
-
30
- AssertThatBDD::Features.download(options)
31
-
32
-
1
+ #!/usr/bin/env ruby
2
+ require 'assertthat-bdd'
3
+ require 'optparse'
4
+
5
+ VERSION = '1.2.0'
6
+
7
+ options = {}
8
+ OptionParser.new do |opt|
9
+ opt.on('-a','--accessKey ACCESS_KEY', 'Access key same as env variable ASSERTTHAT_ACCESS_KEY') { |o| options[:accessKey] = o }
10
+ opt.on('-s','--secretKey SECRET_KEY', 'Secret key same as env variable ASSERTTHAT_SECRET_KEY') { |o| options[:secretKey] = o }
11
+ opt.on('-u','--jiraServerUrl SERVER_URL', 'Jira server URL') { |o| options[:jiraServerUrl] = o }
12
+ opt.on('-p','--projectId PROJECT_ID', 'Jira project id') { |o| options[:projectId] = o }
13
+ opt.on('-o','--outputFolder OUTPUT_FOLDER', 'Featured output folder - default ./features') { |o| options[:outputFolder] = o }
14
+ opt.on('-m','--mode MODE', 'Mode one of automated,manual,both - deafult automated') { |o| options[:mode] = o }
15
+ opt.on('-t','--tags <tag-expression>', 'Cucucmber tag expression for scenarios filtering') { |o| options[:tags] = o }
16
+ opt.on('-j','--jql JQL_FILTER', 'Jql issues filter') { |o| options[:jql] = o }
17
+ opt.on('-x','--proxy PROXY_URL', 'proxy url to connect to Jira') { |o| options[:proxy] = o }
18
+ opt.on_tail('-h', '--help', 'Show help') do
19
+ puts opt
20
+ exit
21
+ end
22
+ opt.on_tail('-v','--version', 'Show version') do
23
+ puts VERSION
24
+ exit
25
+ end
26
+ end.parse!
27
+
28
+ raise OptionParser::MissingArgument, "'projectId' option is not specified" if options[:projectId].nil?
29
+
30
+ AssertThatBDD::Features.download(options)
31
+
32
+
33
33
 
@@ -1,31 +1,31 @@
1
- #!/usr/bin/env ruby
2
- require 'assertthat-bdd'
3
- require 'optparse'
4
-
5
- VERSION = '1.2.0'
6
-
7
- options = {}
8
- OptionParser.new do |opt|
9
- opt.on('-a','--accessKey ACCESS_KEY', 'Access key same as env variable ASSERTTHAT_ACCESS_KEY') { |o| options[:accessKey] = o }
10
- opt.on('-s','--secretKey SECRET_KEY', 'Secret key same as env variable ASSERTTHAT_SECRET_KEY') { |o| options[:secretKey] = o }
11
- opt.on('-u','--jiraServerUrl SERVER_URL', 'Jira server URL') { |o| options[:jiraServerUrl] = o }
12
- opt.on('-p', '--projectId PROJECT_ID', 'Jira project id') { |o| options[:projectId] = o }
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
- opt.on('-f','--jsonReportFolder JSON_FOLDER_PATH', 'Json report folder - default ./reports') { |o| options[:mode] = o }
15
- opt.on('-i','--jsonReportIncludePattern INCLUDE_REGEX', 'Regex to search for cucumber reports - default .*.json') { |o| options[:jql] = o }
16
- opt.on('-x','--proxy PROXY_URL', 'proxy url to connect to Jira') { |o| options[:proxy] = o }
17
- opt.on_tail('-h', '--help', 'Show help') do
18
- puts opt
19
- exit
20
- end
21
- opt.on_tail('-v','--version', 'Show version') do
22
- puts VERSION
23
- exit
24
- end
25
- end.parse!
26
-
27
- raise OptionParser::MissingArgument, "'projectId' option is not specified" if options[:projectId].nil?
28
-
29
- AssertThatBDD::Report.upload(options)
30
-
31
-
1
+ #!/usr/bin/env ruby
2
+ require 'assertthat-bdd'
3
+ require 'optparse'
4
+
5
+ VERSION = '1.2.0'
6
+
7
+ options = {}
8
+ OptionParser.new do |opt|
9
+ opt.on('-a','--accessKey ACCESS_KEY', 'Access key same as env variable ASSERTTHAT_ACCESS_KEY') { |o| options[:accessKey] = o }
10
+ opt.on('-s','--secretKey SECRET_KEY', 'Secret key same as env variable ASSERTTHAT_SECRET_KEY') { |o| options[:secretKey] = o }
11
+ opt.on('-u','--jiraServerUrl SERVER_URL', 'Jira server URL') { |o| options[:jiraServerUrl] = o }
12
+ opt.on('-p', '--projectId PROJECT_ID', 'Jira project id') { |o| options[:projectId] = o }
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
+ opt.on('-f','--jsonReportFolder JSON_FOLDER_PATH', 'Json report folder - default ./reports') { |o| options[:mode] = o }
15
+ opt.on('-i','--jsonReportIncludePattern INCLUDE_REGEX', 'Regex to search for cucumber reports - default .*.json') { |o| options[:jql] = o }
16
+ opt.on('-x','--proxy PROXY_URL', 'proxy url to connect to Jira') { |o| options[:proxy] = o }
17
+ opt.on_tail('-h', '--help', 'Show help') do
18
+ puts opt
19
+ exit
20
+ end
21
+ opt.on_tail('-v','--version', 'Show version') do
22
+ puts VERSION
23
+ exit
24
+ end
25
+ end.parse!
26
+
27
+ raise OptionParser::MissingArgument, "'projectId' option is not specified" if options[:projectId].nil?
28
+
29
+ AssertThatBDD::Report.upload(options)
30
+
31
+
@@ -1,94 +1,99 @@
1
- require 'rest-client'
2
- require 'zip'
3
- require 'find'
4
- require 'json'
5
-
6
- module AssertThatBDD
7
- class Features
8
- def self.download(accessKey: ENV['ASSERTTHAT_ACCESS_KEY'], secretKey: ENV['ASSERTTHAT_ACCESS_KEY'], projectId: nil, outputFolder: './features/', proxy: nil, mode: 'automated', jql: '', tags: '', jiraServerUrl: nil)
9
- RestClient.proxy = proxy unless proxy.nil?
10
- url = 'https://bdd.assertthat.app/rest/api/1/project/'+ projectId +'/features'
11
- url = jiraServerUrl+"/rest/assertthat/latest/project/"+projectId+"/client/features" unless jiraServerUrl.nil?
12
- resource = RestClient::Resource.new(url, :user => accessKey, :password => secretKey, :content_type => 'application/zip')
13
- begin
14
- contents = resource.get(:accept => 'application/zip', params: {mode: mode, jql: jql, tags: tags})
15
- rescue => e
16
-
17
- if e.respond_to?('response') then
18
- if e.response.respond_to?('code') then
19
- case e.response.code
20
- when 401
21
- puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
22
- when 400
23
- puts '*** ERROR: ' + e.response
24
- when 500
25
- puts '*** ERROR: Jira server error (500)'
26
- end
27
- end
28
- else
29
- puts '*** ERROR: Failed download features: ' + e.message
30
- end
31
- return
32
- end
33
- Dir.mkdir("#{outputFolder}") unless File.exists?("#{outputFolder}")
34
- File.open("#{outputFolder}/features.zip", 'wb') {|f| f.write(contents) }
35
- features_count = 0
36
- Zip::File.open("#{outputFolder}/features.zip") do |zip_file|
37
- zip_file.each do |entry|
38
- features_count = features_count + 1
39
- File.delete("#{outputFolder}#{entry.name}") if File.exists?("#{outputFolder}#{entry.name}")
40
- entry.extract("#{outputFolder}#{entry.name}")
41
- end
42
- end
43
- puts "*** INFO: #{features_count} features downloaded"
44
- File.delete("#{outputFolder}/features.zip")
45
- end
46
- end
47
-
48
- class Report
49
- 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 )
50
- url = "https://bdd.assertthat.app/rest/api/1/project/" + projectId + "/report"
51
- url = jiraServerUrl+"/rest/assertthat/latest/project/"+projectId+"/client/report" unless jiraServerUrl.nil?
52
- files = Find.find(jsonReportFolder).grep(/#{jsonReportIncludePattern}/)
53
- puts "*** INFO: #{files.count} files found matching parretn #{jsonReportIncludePattern}:"
54
- puts "*** INFO: #{files}"
55
- runId = -1
56
- files.each do |f|
57
- request = RestClient::Request.new(
58
- :method => :post,
59
- :url => url,
60
- :user => accessKey,
61
- :password => secretKey,
62
- :payload => {
63
- :multipart => true,
64
- :file => File.new(f, 'rb')
65
- },
66
- :headers => { :params =>{:runName => runName, :runId=> runId}}
67
- )
68
- begin
69
- response = request.execute
70
- rescue => e
71
- if e.respond_to?('response') then
72
- if e.response.respond_to?('code') then
73
- case e.response.code
74
- when 401
75
- puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
76
- when 500
77
- puts '*** ERROR: Jira server error (500)'
78
- end
79
- end
80
- else
81
- puts "*** ERROR: Failed to submit json #{f}: " + e.message
82
- end
83
- return
84
- end
85
- resposne_json = JSON.parse(response)
86
- if resposne_json['result'] == 'success'
87
- runId = resposne_json['runId']
88
- else
89
- puts "*** ERROR: Failed to submit json #{f}: " + resposne_json['message']
90
- end
91
- end
92
- end
93
- end
94
- end
1
+ require 'rest-client'
2
+ require 'zip'
3
+ require 'find'
4
+ require 'json'
5
+
6
+ module AssertThatBDD
7
+ class Features
8
+ def self.download(accessKey: ENV['ASSERTTHAT_ACCESS_KEY'], secretKey: ENV['ASSERTTHAT_ACCESS_KEY'], projectId: nil, outputFolder: './features/', proxy: nil, mode: 'automated', jql: '', tags: '', jiraServerUrl: nil)
9
+ RestClient.proxy = proxy unless proxy.nil?
10
+ url = ['https://heavy-bat-23.loca.lt/rest/api/1/project/', projectId, '/features'].map(&:to_s).join('')
11
+ url = [jiraServerUrl,"/rest/assertthat/latest/project/",projectId,"/client/features"].map(&:to_s).join('') unless jiraServerUrl.nil?
12
+ resource = RestClient::Resource.new(url, :user => accessKey, :password => secretKey, :content_type => 'application/zip')
13
+ begin
14
+ resource.get(:accept => 'application/zip', params: {mode: mode, jql: jql, tags: tags}) do |response, request, result|
15
+ Dir.mkdir("#{outputFolder}") unless File.exists?("#{outputFolder}")
16
+ File.open("#{outputFolder}/features.zip", 'wb') {|f| f.write(response) }
17
+ features_count = 0
18
+ Zip::File.open("#{outputFolder}/features.zip") do |zip_file|
19
+ zip_file.each do |entry|
20
+ features_count = features_count + 1
21
+ File.delete("#{outputFolder}#{entry.name}") if File.exists?("#{outputFolder}#{entry.name}")
22
+ entry.extract("#{outputFolder}#{entry.name}")
23
+ end
24
+ if response.headers.member?('features_count'.to_sym) and response.headers.member?('scenarios_count'.to_sym) then
25
+ puts "*** INFO: #{response.headers['features_count'.to_sym]} features downloaded with #{response.headers['scenarios_count'.to_sym]} scenarios"
26
+ else
27
+ puts "*** INFO: #{features_count} features downloaded"
28
+ end
29
+ 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
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ 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 )
55
+ url = "https://bdd.assertthat.app/rest/api/1/project/" + projectId + "/report"
56
+ url = jiraServerUrl+"/rest/assertthat/latest/project/"+projectId+"/client/report" unless jiraServerUrl.nil?
57
+ files = Find.find(jsonReportFolder).grep(/#{jsonReportIncludePattern}/)
58
+ puts "*** INFO: #{files.count} files found matching parretn #{jsonReportIncludePattern}:"
59
+ puts "*** INFO: #{files}"
60
+ runId = -1
61
+ files.each do |f|
62
+ request = RestClient::Request.new(
63
+ :method => :post,
64
+ :url => url,
65
+ :user => accessKey,
66
+ :password => secretKey,
67
+ :payload => {
68
+ :multipart => true,
69
+ :file => File.new(f, 'rb')
70
+ },
71
+ :headers => { :params =>{:runName => runName, :runId=> runId}}
72
+ )
73
+ begin
74
+ response = request.execute
75
+ rescue => e
76
+ if e.respond_to?('response') then
77
+ if e.response.respond_to?('code') then
78
+ case e.response.code
79
+ when 401
80
+ puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
81
+ when 500
82
+ puts '*** ERROR: Jira server error (500)'
83
+ end
84
+ end
85
+ else
86
+ puts "*** ERROR: Failed to submit json #{f}: " + e.message
87
+ end
88
+ return
89
+ end
90
+ resposne_json = JSON.parse(response)
91
+ if resposne_json['result'] == 'success'
92
+ runId = resposne_json['runId']
93
+ else
94
+ puts "*** ERROR: Failed to submit json #{f}: " + resposne_json['message']
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assertthat-bdd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glib Briia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2020-05-08 00:00:00.000000000 Z
@@ -34,23 +34,23 @@ dependencies:
34
34
  name: rubyzip
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: 1.0.0
40
37
  - - "~>"
41
38
  - !ruby/object:Gem::Version
42
39
  version: '1.0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 1.0.0
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: 1.0.0
50
47
  - - "~>"
51
48
  - !ruby/object:Gem::Version
52
49
  version: '1.0'
53
- description:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.0.0
53
+ description:
54
54
  email: glib@assertthat.com
55
55
  executables:
56
56
  - assertthat-bdd-features
@@ -65,7 +65,7 @@ homepage: https://rubygems.org/gems/assertthat-bdd
65
65
  licenses:
66
66
  - MIT
67
67
  metadata: {}
68
- post_install_message:
68
+ post_install_message:
69
69
  rdoc_options: []
70
70
  require_paths:
71
71
  - lib
@@ -80,8 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  requirements: []
83
- rubygems_version: 3.0.8
84
- signing_key:
83
+ rubygems_version: 3.2.22
84
+ signing_key:
85
85
  specification_version: 4
86
86
  summary: AssertThat bdd integration for Ruby
87
87
  test_files: []