itriagetestrail 0.5.8 → 0.5.9

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
  SHA1:
3
- metadata.gz: e15c8856fa4681acc3c252fcc18b387ff4f450a5
4
- data.tar.gz: d07175b6cd410ae7f0feab3d580c52149c71ab15
3
+ metadata.gz: f8a0497d1d4ff6a5ced902e6925403378daa9a97
4
+ data.tar.gz: a66b275082507d0d052c68b52d5adb67e31b3d02
5
5
  SHA512:
6
- metadata.gz: 73e6907a83e874a81bfda43baf4ba5b32f971b4f3487d7bd5e4d8862aa9e56e15069c3938218a221e464df25e7a80187837bf941f310ec56304737da31f885c9
7
- data.tar.gz: d9cc6a23c2010b334c3cf3ea8bbd84199e30e27d8e53ab3b7ef55e458e44da8aad00585d2d68b23924146e672f3570bd0c001510d8532616df2987c78e58a402
6
+ metadata.gz: ecfb2a903c4c65b467673e464a3451c6ceb14677b67e941854a7cad40f17f4fb5f8431f0b722f1c85fa2d1851fb5b4f89ec4a1643d5e4d0643ded2a3fa2e3241
7
+ data.tar.gz: 32c9a51699c53076acff5c4a616a2c88d787e340e404596fcf488b6c6a33b02d9199043b75941cbd6b396ab2b086ac04648f8d404558b430c89820f01b4c1d35
@@ -0,0 +1,44 @@
1
+ require 'itriagetestrail'
2
+ module Itriagetestrail
3
+ class TRCucumber13 < TestRailInterface
4
+
5
+ def record_result(scenario)
6
+ return if execute == false
7
+ begin
8
+ if scenario.class.to_s == 'Cucumber::Ast::OutlineTable::ExampleRow'
9
+ scenario_cell_id = []
10
+ scenario.name.split('|')[1..50].each {|cell| scenario_cell_id << cell.gsub(/[\| "]/, "") }
11
+ @scenario_title = "#{scenario.scenario_outline.title}, Example: #{scenario_cell_id}"
12
+ @external_id = "#{scenario.scenario_outline.feature.name};#{@scenario_title}"[0,249]
13
+ @scenario_steps = scenario.scenario_outline.raw_steps.select{'name'}.collect { |name| name.name }.join("\n")
14
+ else
15
+ # identifiers: scenario.feature.name, scenario.name
16
+ @external_id = "#{scenario.feature.title};#{scenario.title}"
17
+ @scenario_title = scenario.title
18
+ @scenario_steps = scenario.steps.select{'name'}.collect { |name| name.name }.join("\n")
19
+ end
20
+
21
+ scenario.test_steps.select{'name'}.each { |name| steps << name.name unless name.name == 'Before hook' }
22
+ @scenario_steps = steps.each { |step| step }.join('\n')
23
+
24
+ if scenario.passed?
25
+ store_result(@scenario_title, @external_id, @scenario_steps, 1, '')
26
+ else
27
+ store_result(@scenario_title, @external_id, @scenario_steps, "#{ENV['RERUN'] ? 5 : 4}".to_i, "#{scenario.exception.class}\n#{scenario.exception}\n#{scenario.exception.backtrace}")
28
+ end
29
+ update_test_run
30
+ send_results_to_testrail
31
+ rescue => exception
32
+ puts "TESTRAIL ENCOUNTERED AN ERROR: #{exception}\n #{@external_id} \n\n"
33
+ end
34
+ end
35
+
36
+ def shutdown
37
+ if execute
38
+ sleep 3 # testrail service rate limit precaution
39
+ send_results_to_testrail
40
+ super
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,40 @@
1
+ require 'itriagetestrail'
2
+ module Itriagetestrail
3
+ class TRCucumber20 < TestRailInterface
4
+
5
+ def record_result(scenario)
6
+ return if execute == false
7
+ begin
8
+ if scenario.class.to_s == 'Cucumber::RunningTestCase::ScenarioOutlineExample'
9
+ @external_id = "#{scenario.feature.short_name};#{scenario.name};#{scenario.cell_values}"[0,249]
10
+ else
11
+ @external_id = "#{scenario.feature.short_name};#{scenario.name}"
12
+ end
13
+ @scenario_title = scenario.name
14
+
15
+ steps = []
16
+
17
+ scenario.test_steps.select{'name'}.each { |name| steps << name.name unless name.name == 'Before hook' }
18
+ @scenario_steps = steps.each { |step| step }.join('\n')
19
+
20
+ if scenario.passed?
21
+ store_result(@scenario_title, @external_id, @scenario_steps, 1, '')
22
+ else
23
+ store_result(@scenario_title, @external_id, @scenario_steps, "#{ENV['RERUN'] ? 5 : 4}".to_i, "#{scenario.exception.class}\n#{scenario.exception}\n#{scenario.exception.backtrace}")
24
+ end
25
+ update_test_run
26
+ send_results_to_testrail
27
+ rescue => exception
28
+ puts "TESTRAIL ENCOUNTERED AN ERROR: #{exception}\n #{@external_id} \n\n"
29
+ end
30
+ end
31
+
32
+ def shutdown
33
+ if execute
34
+ sleep 3 # testrail service rate limit precaution
35
+ send_results_to_testrail
36
+ super
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,39 +1,19 @@
1
1
  require 'itriagetestrail'
2
2
  module Itriagetestrail
3
3
  class TRMiniTest < TestRailInterface
4
-
5
- def initialize
6
- if ENV['TZINFO_TIME_ZONE'].nil? || ENV['TZINFO_TIME_ZONE'].empty?
7
- time_zone = 'America/Denver'
8
- else
9
- time_zone = ENV['TZINFO_TIME_ZONE']
10
- end
11
-
12
- @testrail_config = {
13
- site: ENV['TESTRAIL_SITE'],
14
- user: ENV['TESTRAIL_USER'],
15
- password: ENV['TESTRAIL_PASSWORD'],
16
- tzinfoTimeZone: time_zone,
17
- projectId: ENV['TESTRAIL_PROJECT_ID'],
18
- projectName: ENV['UTOPIA_NAME'],
19
- run_id: ENV['TESTRAIL_RUN_ID'],
20
- close_run: ENV['TESTRAIL_CLOSE_RUN'],
21
- origin: ENV['GIT_BRANCH'],
22
- jenkinsBuild: ENV['BUILD_NUMBER'],
23
- appVersion: nil
24
- }
25
- super(@testrail_config)
26
- end
27
-
28
4
  def record_result(test, name, failures)
29
5
  return if execute == false
30
- @external_id = "#{test.class}##{name}"
31
- if self.passed?
32
- store_result(name, @external_id, '', 1, '')
33
- elsif failures.inspect.include? 'Minitest::Skip'
34
- store_result(name, @external_id, '', 6, failures.inspect)
35
- else
36
- store_result(name, @external_id, '', 5, failures.inspect)
6
+ begin
7
+ @external_id = "#{test.class}##{name}"
8
+ if self.passed?
9
+ store_result(name, @external_id, '', 1, '')
10
+ elsif failures.inspect.include? 'Minitest::Skip'
11
+ store_result(name, @external_id, '', 6, failures.inspect)
12
+ else
13
+ store_result(name, @external_id, '', 5, failures.inspect)
14
+ end
15
+ rescue => exception
16
+ puts "TESTRAIL ENCOUNTERED AN ERROR: #{exception}\n #{@external_id} \n\n"
37
17
  end
38
18
  end
39
19
 
@@ -1,3 +1,3 @@
1
1
  module Itriagetestrail
2
- VERSION = '0.5.8'
2
+ VERSION = '0.5.9'
3
3
  end
@@ -18,9 +18,9 @@ module Itriagetestrail
18
18
  attr_reader :results
19
19
  attr_reader :external_results
20
20
 
21
- def initialize(testrail_config)
21
+ def initialize()
22
22
  @setup = false
23
- @testrail_config = testrail_config
23
+ config
24
24
 
25
25
  if File.exist?('./tmp/testrail_id')
26
26
  @run_id = File.read('./tmp/testrail_id')
@@ -53,6 +53,29 @@ module Itriagetestrail
53
53
  @batch_size = @testrail_config[:batch_size] || 0
54
54
  end
55
55
 
56
+ def config
57
+ if ENV['TZINFO_TIME_ZONE'].nil? || ENV['TZINFO_TIME_ZONE'].empty?
58
+ time_zone = 'America/Denver'
59
+ else
60
+ time_zone = ENV['TZINFO_TIME_ZONE']
61
+ end
62
+
63
+ @testrail_config = {
64
+ site: ENV['TESTRAIL_SITE'],
65
+ user: ENV['TESTRAIL_USER'],
66
+ password: ENV['TESTRAIL_PASSWORD'],
67
+ tzinfoTimeZone: time_zone,
68
+ projectId: ENV['TESTRAIL_PROJECT_ID'],
69
+ projectName: ENV['APP_NAME'],
70
+ suiteName: ENV['TESTRAIL_SUITE_NAME'],
71
+ run_id: ENV['TESTRAIL_RUN_ID'],
72
+ close_run: ENV['TESTRAIL_CLOSE_RUN'],
73
+ origin: ENV['GIT_BRANCH'],
74
+ jenkinsBuild: ENV['BUILD_NUMBER'],
75
+ appVersion: nil
76
+ }
77
+ end
78
+
56
79
  def setup?
57
80
  @setup
58
81
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itriagetestrail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - a801069
@@ -61,7 +61,8 @@ files:
61
61
  - lib/itriagetestrail.rb
62
62
  - lib/itriagetestrail/pool.rb
63
63
  - lib/itriagetestrail/testrail_binding.rb
64
- - lib/itriagetestrail/trcucumber.rb
64
+ - lib/itriagetestrail/trcucumber13.rb
65
+ - lib/itriagetestrail/trcucumber20.rb
65
66
  - lib/itriagetestrail/trminitest.rb
66
67
  - lib/itriagetestrail/version.rb
67
68
  homepage:
@@ -1,59 +0,0 @@
1
- require 'itriagetestrail'
2
- module Itriagetestrail
3
- class TRCucumber < TestRailInterface
4
-
5
- def initialize
6
- if ENV['TZINFO_TIME_ZONE'].nil? || ENV['TZINFO_TIME_ZONE'].empty?
7
- time_zone = 'America/Denver'
8
- else
9
- time_zone = ENV['TZINFO_TIME_ZONE']
10
- end
11
-
12
- @testrail_config = {
13
- site: ENV['TESTRAIL_SITE'],
14
- user: ENV['TESTRAIL_USER'],
15
- password: ENV['TESTRAIL_PASSWORD'],
16
- tzinfoTimeZone: time_zone,
17
- projectId: ENV['TESTRAIL_PROJECT_ID'],
18
- projectName: ENV['UTOPIA_NAME'],
19
- run_id: ENV['TESTRAIL_RUN_ID'],
20
- close_run: ENV['TESTRAIL_CLOSE_RUN'],
21
- origin: ENV['GIT_BRANCH'],
22
- jenkinsBuild: ENV['BUILD_NUMBER'],
23
- appVersion: nil
24
- }
25
- super(@testrail_config)
26
- end
27
-
28
- def record_result(scenario)
29
- return if execute == false
30
- if scenario.class.to_s == 'Cucumber::RunningTestCase::ScenarioOutlineExample'
31
- @external_id = "#{scenario.feature.short_name};#{scenario.name};#{scenario.cell_values}"[0,249]
32
- else
33
- @external_id = "#{scenario.feature.short_name};#{scenario.name}"
34
- end
35
- @scenario_title = scenario.name
36
-
37
- steps = []
38
-
39
- scenario.test_steps.select{'name'}.each { |name| steps << name.name unless name.name == 'Before hook' }
40
- @scenario_steps = steps.each { |step| step }.join('\n')
41
-
42
- if scenario.passed?
43
- store_result(@scenario_title, @external_id, @scenario_steps, 1, '')
44
- else
45
- store_result(@scenario_title, @external_id, @scenario_steps, "#{ENV['RERUN'] ? 5 : 4}".to_i, "#{scenario.exception.class}\n#{scenario.exception}\n#{scenario.exception.backtrace}")
46
- end
47
- update_test_run
48
- send_results_to_testrail
49
- end
50
-
51
- def shutdown
52
- if execute
53
- sleep 3 # testrail service rate limit precaution
54
- send_results_to_testrail
55
- super
56
- end
57
- end
58
- end
59
- end