assertthat-bdd 1.0.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80e414c9443556d6ca0bf2495db50c4ace281c8e8495a1b55658e2dbfe629000
4
- data.tar.gz: 14c721b228cc16855b5248b69689d87f777573cfe5a9f7de83324b509b24efc0
3
+ metadata.gz: 89b7bffbb130b5733cc9b2fd356a9f864a80d708457574bd6f211bb31e1188bf
4
+ data.tar.gz: bf6529f52a3ffb2c51ebbd1d268288f5a3f89cd2aeda3caf79456591e3edbc51
5
5
  SHA512:
6
- metadata.gz: f64dfb3906476c99e23000091ce7fe0e7b784bece1d07e0c37537389bfac0777e818b52cf063316be3dc6d4a4213fb4fbb9c899e3a890105e2089c3de5b24566
7
- data.tar.gz: 564c3914995361bd92ba4e05d1ef67f943f4bb680b2a8e10208b7f96716508e961e78f74fb2d387189d33d618b43227684e71eb6a8bd5b284f3b06303908e1b6
6
+ metadata.gz: 7af3a0ef45966f55d4c38fe10386492782a42109c4e85b649bbde9df00cda59241d64489d62134cc4e41d2f610bc36dee7ae458a25972b57c4d323b0c8e9ecea
7
+ data.tar.gz: c6199e9292e77abc2265ba1a36b6e7af1bb9fda66bae43de6db309aa464b5e091c2b197e40dd9c35bcb1f1fd2cef3e1bbafe510d6aea0b3799ebd41caeba4f63
@@ -2,12 +2,13 @@
2
2
  require 'assertthat-bdd'
3
3
  require 'optparse'
4
4
 
5
- VERSION = '1.0.0'
5
+ VERSION = '1.2.0'
6
6
 
7
7
  options = {}
8
8
  OptionParser.new do |opt|
9
9
  opt.on('-a','--accessKey ACCESS_KEY', 'Access key same as env variable ASSERTTHAT_ACCESS_KEY') { |o| options[:accessKey] = o }
10
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 }
11
12
  opt.on('-p','--projectId PROJECT_ID', 'Jira project id') { |o| options[:projectId] = o }
12
13
  opt.on('-o','--outputFolder OUTPUT_FOLDER', 'Featured output folder - default ./features') { |o| options[:outputFolder] = o }
13
14
  opt.on('-m','--mode MODE', 'Mode one of automated,manual,both - deafult automated') { |o| options[:mode] = o }
@@ -2,12 +2,13 @@
2
2
  require 'assertthat-bdd'
3
3
  require 'optparse'
4
4
 
5
- VERSION = '0.0.1'
5
+ VERSION = '1.2.0'
6
6
 
7
7
  options = {}
8
8
  OptionParser.new do |opt|
9
9
  opt.on('-a','--accessKey ACCESS_KEY', 'Access key same as env variable ASSERTTHAT_ACCESS_KEY') { |o| options[:accessKey] = o }
10
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 }
11
12
  opt.on('-p', '--projectId PROJECT_ID', 'Jira project id') { |o| options[:projectId] = o }
12
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 }
13
14
  opt.on('-f','--jsonReportFolder JSON_FOLDER_PATH', 'Json report folder - default ./reports') { |o| options[:mode] = o }
@@ -5,9 +5,10 @@ require 'json'
5
5
 
6
6
  module AssertThatBDD
7
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: '')
8
+ def self.download(accessKey: ENV['ASSERTTHAT_ACCESS_KEY'], secretKey: ENV['ASSERTTHAT_ACCESS_KEY'], projectId: nil, outputFolder: './features/', proxy: nil, mode: 'automated', jql: '', jiraServerUrl: nil)
9
9
  RestClient.proxy = proxy unless proxy.nil?
10
- url = 'https://bdd.assertthat.com/rest/api/1/project/'+ projectId +'/features'
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?
11
12
  resource = RestClient::Resource.new(url, :user => accessKey, :password => secretKey, :content_type => 'application/zip')
12
13
  begin
13
14
  contents = resource.get(:accept => 'application/zip', params: {mode: mode, jql: jql})
@@ -17,34 +18,40 @@ module AssertThatBDD
17
18
  if e.response.respond_to?('code') then
18
19
  case e.response.code
19
20
  when 401
20
- puts '[ERROR] Unauthorized error (401). Supplied secretKey/accessKey is invalid'
21
+ puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
21
22
  when 400
22
- puts '[ERROR] ' + e.response
23
+ puts '*** ERROR: ' + e.response
23
24
  when 500
24
- puts '[ERROR] Jira server error (500)'
25
+ puts '*** ERROR: Jira server error (500)'
25
26
  end
26
27
  end
27
28
  else
28
- puts '[ERROR] Failed download features: ' + e.message
29
+ puts '*** ERROR: Failed download features: ' + e.message
29
30
  end
30
31
  return
31
32
  end
32
33
  Dir.mkdir("#{outputFolder}") unless File.exists?("#{outputFolder}")
33
34
  File.open("#{outputFolder}/features.zip", 'wb') {|f| f.write(contents) }
35
+ features_count = 0
34
36
  Zip::File.open("#{outputFolder}/features.zip") do |zip_file|
35
37
  zip_file.each do |entry|
38
+ features_count = features_count + 1
36
39
  File.delete("#{outputFolder}#{entry.name}") if File.exists?("#{outputFolder}#{entry.name}")
37
40
  entry.extract("#{outputFolder}#{entry.name}")
38
41
  end
39
42
  end
43
+ puts "*** INFO: #{features_count} features downloaded"
40
44
  File.delete("#{outputFolder}/features.zip")
41
45
  end
42
46
  end
43
47
 
44
48
  class Report
45
- 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' )
46
- url = "https://bdd.assertthat.com/rest/api/1/project/" + projectId + "/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?
47
52
  files = Find.find(jsonReportFolder).grep(/#{jsonReportIncludePattern}/)
53
+ puts "*** INFO: #{files.count} files found matching parretn #{jsonReportIncludePattern}:"
54
+ puts "*** INFO: #{files}"
48
55
  runId = -1
49
56
  files.each do |f|
50
57
  request = RestClient::Request.new(
@@ -65,13 +72,13 @@ module AssertThatBDD
65
72
  if e.response.respond_to?('code') then
66
73
  case e.response.code
67
74
  when 401
68
- puts '[ERROR] Unauthorized error (401). Supplied secretKey/accessKey is invalid'
75
+ puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
69
76
  when 500
70
- puts '[ERROR] Jira server error (500)'
77
+ puts '*** ERROR: Jira server error (500)'
71
78
  end
72
79
  end
73
80
  else
74
- puts '[ERROR] Failed to submit report: ' + e.message
81
+ puts "*** ERROR: Failed to submit json #{f}: " + e.message
75
82
  end
76
83
  return
77
84
  end
@@ -79,9 +86,9 @@ module AssertThatBDD
79
86
  if resposne_json['result'] == 'success'
80
87
  runId = resposne_json['runId']
81
88
  else
82
- puts '[ERROR] Failed to submit report: ' + resposne_json['message']
89
+ puts "*** ERROR: Failed to submit json #{f}: " + resposne_json['message']
83
90
  end
84
91
  end
85
92
  end
86
93
  end
87
- end
94
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: assertthat-bdd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glib Briia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-07 00:00:00.000000000 Z
11
+ date: 2020-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -34,24 +34,24 @@ 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'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 1.0.0
53
53
  description:
54
- email: glib.briia@assertthat.com
54
+ email: glib@assertthat.com
55
55
  executables:
56
56
  - assertthat-bdd-features
57
57
  - assertthat-bdd-report
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  requirements: []
83
83
  rubyforge_project:
84
- rubygems_version: 2.7.8
84
+ rubygems_version: 2.7.7
85
85
  signing_key:
86
86
  specification_version: 4
87
87
  summary: AssertThat bdd integration for Ruby