assertthat-bdd 1.4.0 → 1.6.2
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 +32 -32
- data/bin/assertthat-bdd-report +31 -31
- data/lib/assertthat-bdd.rb +91 -94
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60460d67c013f3bedb78f3aa6a7f08e0c9a275e88fc5d1b1ac9db5a99816a63d
|
4
|
+
data.tar.gz: 36d63dcad252b6628194a5aae2532bd2170744e5c44fe4e32dbc23892e001b62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fae48177c21c0d0be2f1f90ccace22cda3138a21b0ef483c01e163f8b96042e7c6dc5f32e5518ec9e85ccb856db30f987f04e33f83b6610f19674b5bde3bc48f
|
7
|
+
data.tar.gz: '01748f34574788956dd1a4e4cda654d1de02bfba8231fd146e4a7f647a2b4009a327e2cd6700984965b425b601d444983ece49bbb34e9bbd7a0f2c94eeed9588'
|
data/bin/assertthat-bdd-features
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'assertthat-bdd'
|
3
|
-
require 'optparse'
|
4
|
-
|
5
|
-
VERSION = '1.2
|
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.6.2'
|
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
|
|
data/bin/assertthat-bdd-report
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'assertthat-bdd'
|
3
|
-
require 'optparse'
|
4
|
-
|
5
|
-
VERSION = '1.2
|
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.6.2'
|
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
|
+
|
data/lib/assertthat-bdd.rb
CHANGED
@@ -1,94 +1,91 @@
|
|
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/'
|
11
|
-
url = jiraServerUrl
|
12
|
-
resource = RestClient::Resource.new(url, :user => accessKey, :password => secretKey, :content_type => 'application/zip')
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
File.delete("#{outputFolder}
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
:
|
59
|
-
:
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
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://bdd.assertthat.app/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
|
+
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
|
25
|
+
Dir.mkdir("#{outputFolder}") unless File.exists?("#{outputFolder}")
|
26
|
+
File.open("#{outputFolder}/features.zip", 'wb') {|f| f.write(response) }
|
27
|
+
features_count = 0
|
28
|
+
Zip::File.open("#{outputFolder}/features.zip") do |zip_file|
|
29
|
+
zip_file.each do |entry|
|
30
|
+
features_count = features_count + 1
|
31
|
+
File.delete("#{outputFolder}#{entry.name}") if File.exists?("#{outputFolder}#{entry.name}")
|
32
|
+
entry.extract("#{outputFolder}#{entry.name}")
|
33
|
+
end
|
34
|
+
if response.headers.member?('features_count'.to_sym) and response.headers.member?('scenarios_count'.to_sym) then
|
35
|
+
puts "*** INFO: #{response.headers['features_count'.to_sym]} features downloaded with #{response.headers['scenarios_count'.to_sym]} scenarios"
|
36
|
+
else
|
37
|
+
puts "*** INFO: #{features_count} features downloaded"
|
38
|
+
end
|
39
|
+
File.delete("#{outputFolder}/features.zip")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class Report
|
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', jiraServerUrl: nil )
|
47
|
+
url = "https://bdd.assertthat.app/rest/api/1/project/" + projectId + "/report"
|
48
|
+
url = jiraServerUrl+"/rest/assertthat/latest/project/"+projectId+"/client/report" unless jiraServerUrl.nil?
|
49
|
+
files = Find.find(jsonReportFolder).grep(/#{jsonReportIncludePattern}/)
|
50
|
+
puts "*** INFO: #{files.count} files found matching parretn #{jsonReportIncludePattern}:"
|
51
|
+
puts "*** INFO: #{files}"
|
52
|
+
runId = -1
|
53
|
+
files.each do |f|
|
54
|
+
request = RestClient::Request.new(
|
55
|
+
:method => :post,
|
56
|
+
:url => url,
|
57
|
+
:user => accessKey,
|
58
|
+
:password => secretKey,
|
59
|
+
:payload => {
|
60
|
+
:multipart => true,
|
61
|
+
:file => File.new(f, 'rb')
|
62
|
+
},
|
63
|
+
:headers => { :params =>{:runName => runName, :runId=> runId}}
|
64
|
+
)
|
65
|
+
begin
|
66
|
+
response = request.execute
|
67
|
+
rescue => e
|
68
|
+
if e.respond_to?('response') then
|
69
|
+
if e.response.respond_to?('code') then
|
70
|
+
case e.response.code
|
71
|
+
when 401
|
72
|
+
puts '*** ERROR: Unauthorized error (401). Supplied secretKey/accessKey is invalid'
|
73
|
+
when 500
|
74
|
+
puts '*** ERROR: Jira server error (500)'
|
75
|
+
end
|
76
|
+
end
|
77
|
+
else
|
78
|
+
puts "*** ERROR: Failed to submit json #{f}: " + e.message
|
79
|
+
end
|
80
|
+
return
|
81
|
+
end
|
82
|
+
resposne_json = JSON.parse(response)
|
83
|
+
if resposne_json['result'] == 'success'
|
84
|
+
runId = resposne_json['runId']
|
85
|
+
else
|
86
|
+
puts "*** ERROR: Failed to submit json #{f}: " + resposne_json['message']
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
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
|
+
version: 1.6.2
|
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
|
-
|
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.
|
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: []
|