atm_formatter 0.1.34 → 0.1.35
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 +4 -4
- data/lib/atm_formatter/tasks/test_manipulation_tasks.rb +20 -20
- data/lib/atm_formatter/version.rb +1 -1
- data/lib/atm_result_formatter.rb +9 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62a6c68dddcb2104820e891a92a4e244b3d7d810
|
4
|
+
data.tar.gz: b31b9ceafc3c71d15f43397d1545db73cfe9a04b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9cf1f121d9bfbca724948d35d87641b8b070acc53ae782d46a67b68dbe30905b9be2060f723b17c31d408c0d508a1a47da30063cb9ed2b8a7c533ac85fc784a
|
7
|
+
data.tar.gz: c02b67ef8d3068e65843940509ec89157d7e214a7b8d1c5ec0a0ce8fc21aedc964bff032a3b6fc49a9485c4db6939fb449e7dcc20c4772d1ea66f73d5eb8ec42
|
@@ -14,44 +14,44 @@ module ATM
|
|
14
14
|
def install
|
15
15
|
namespace 'atm' do
|
16
16
|
desc 'Create test cases with steps on Adaptavist Test Management'
|
17
|
-
task :create_with_steps, [:path] do |_t,
|
18
|
-
exec("bundle exec rspec #{
|
17
|
+
task :create_with_steps, [:path] do |_t, options|
|
18
|
+
exec("bundle exec rspec #{options[:path] if options[:path]} --format ATMCreateTestFormatter --dry-run -r atm_formatter/example")
|
19
19
|
end
|
20
20
|
|
21
21
|
desc 'Create test cases on Adaptavist Test Management'
|
22
|
-
task :create, [:path] do |_t,
|
23
|
-
exec("bundle exec rspec #{
|
22
|
+
task :create, [:path] do |_t, options|
|
23
|
+
exec("bundle exec rspec #{options[:path] if options[:path]} --format ATMCreateTestFormatter --dry-run")
|
24
24
|
end
|
25
25
|
|
26
26
|
desc 'Update test cases with steps on Adaptavist Test Management'
|
27
|
-
task :update_with_steps, [:path] do |_t,
|
28
|
-
exec("bundle exec rspec #{
|
27
|
+
task :update_with_steps, [:path] do |_t, options|
|
28
|
+
exec("bundle exec rspec #{options[:path] if options[:path]} --format ATMUpdateTestFormatter --dry-run -r atm_formatter/example")
|
29
29
|
end
|
30
30
|
|
31
31
|
desc 'Update test cases on Adaptavist Test Management'
|
32
|
-
task :update, [:path] do |_t,
|
33
|
-
exec("bundle exec rspec #{
|
32
|
+
task :update, [:path] do |_t, options|
|
33
|
+
exec("bundle exec rspec #{options[:path] if options[:path]} --format ATMUpdateTestFormatter --dry-run")
|
34
34
|
end
|
35
35
|
|
36
36
|
desc 'Upload saved test results'
|
37
|
-
task :upload, %i[url username password file_path] do |_t,
|
38
|
-
client = ATM::Client.new(base_url:
|
39
|
-
files =
|
37
|
+
task :upload, %i[url username password file_path] do |_t, options|
|
38
|
+
client = ATM::Client.new(base_url: options[:url], username: options[:username], password: options[:password], auth_type: :basic)
|
39
|
+
files = options[:file_path] ? Dir.glob(options[:file_path]) : Dir.glob('test_results/*.json')
|
40
40
|
|
41
|
-
files.each do |
|
42
|
-
puts "working on: #{
|
43
|
-
File.open(
|
44
|
-
file_data = JSON.parse(File.read(
|
41
|
+
files.each do |json_file|
|
42
|
+
puts "working on: #{json_file}..."
|
43
|
+
File.open(json_file, 'r') do |_test_case_data|
|
44
|
+
file_data = JSON.parse(File.read(json_file))
|
45
45
|
progressbar = ProgressBar.create(total: file_data['test_cases'].size, format: 'Progress %c/%C |%B| %a')
|
46
|
-
file_data['test_cases'].each do |
|
47
|
-
test_run_id =
|
48
|
-
test_case_id = test_case.delete('test_case') if test_run_id
|
46
|
+
file_data['test_cases'].each do |test_data|
|
47
|
+
test_run_id = test_data.delete('test_run_id')
|
49
48
|
|
50
49
|
if test_run_id
|
51
|
-
|
50
|
+
test_case_id = test_data.delete('test_case_id')
|
51
|
+
client.TestRun.create_new_test_run_result(test_run_id, test_case_id, test_data)
|
52
52
|
progressbar.increment
|
53
53
|
else
|
54
|
-
warn(
|
54
|
+
warn("TEST RUN ID for test_case_id: '#{test_case_id}' was not specified.")
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
data/lib/atm_result_formatter.rb
CHANGED
@@ -29,11 +29,14 @@ class ATMResultFormatter < RSpec::Core::Formatters::BaseFormatter
|
|
29
29
|
file_path = "#{file_name}_#{@time_stamp}"
|
30
30
|
@test_results[file_path.to_sym] = { test_cases: [] }
|
31
31
|
test_data = @client.TestRun.process_result(process_metadata(example))
|
32
|
-
@test_data <<
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
@test_data << if ATMFormatter.config.test_run_id
|
33
|
+
test_data.merge!(test_run_id: ATMFormatter.config.test_run_id,
|
34
|
+
test_case_id: example.metadata[:test_id],
|
35
|
+
file_path: file_path)
|
36
|
+
else
|
37
|
+
test_data.merge!(test_case_id: example.metadata[:test_id],
|
38
|
+
file_path: file_path)
|
39
|
+
end
|
37
40
|
end
|
38
41
|
|
39
42
|
@test_results.each do |k, _v|
|
@@ -82,7 +85,7 @@ class ATMResultFormatter < RSpec::Core::Formatters::BaseFormatter
|
|
82
85
|
|
83
86
|
def process_metadata(example)
|
84
87
|
{
|
85
|
-
|
88
|
+
test_case_id: test_id(example),
|
86
89
|
status: status(example.metadata[:execution_result]),
|
87
90
|
environment: fetch_environment(example),
|
88
91
|
comment: comment(example.metadata),
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atm_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.35
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azohra
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: atm_ruby
|