testrail_rspec 0.0.4 → 0.0.5

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: 9272b62da5b94f104f53e740510914f64374e46a
4
- data.tar.gz: 2221409e108182f17e44027fed0721b0eee8f09a
3
+ metadata.gz: ecca57c0223b9bae03c9b4338e6a844a38de8a07
4
+ data.tar.gz: db2f1f76f0e52296d6c73d4656a0578a7b98fd84
5
5
  SHA512:
6
- metadata.gz: 798c0feb5fde6eb3ef913b932b027a6023823d35079c5bc70d05fb6ff2da97fd370256136330ce2dfc562cc3807588bf51c6bb38ccd22c5c0e5b01a493a23910
7
- data.tar.gz: 7543b737a2660059b5f1666dd8e79f75136430c2d57152403ee560e78428d4079a77c5397388ff5f3cccf0f1a04b71d463962aa08c32e685deb2a3e76ae9d257
6
+ metadata.gz: b004b3c593c4bc8d8431e001b68707e654d9306aa6a2ed063439ad17cfc5317363b9a8cb2f938a5ae29f9737655c770e43a1fe4f1ccd2463e03c984a838f3aa3
7
+ data.tar.gz: 914821a0f45143abd5b5dc151644d03b01b7206c4f155e0c31e104da72d6e8e4bc48193fbb67e29f1d9314031adc176e5d6ddaad3da96b7d1191fd54502511da
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # TestrailRspec
2
+ [![Gem Version](https://badge.fury.io/rb/testrail_rspec.svg)](http://badge.fury.io/rb/testrail_rspec)
2
3
 
3
4
  This gem provides custom RSpec formatter allowing to export test results directly to [TestRail][1] instance via their [API][2].
4
5
 
@@ -43,6 +43,7 @@ module Testrail
43
43
  end
44
44
 
45
45
  # ---------------------------------------------------> projects ----------------------------------------------------
46
+
46
47
  def get_projects
47
48
  @projects ||= @client.send_get('get_projects')
48
49
  end
@@ -59,6 +60,7 @@ module Testrail
59
60
  end
60
61
 
61
62
  # ----------------------------------------------------> suites <----------------------------------------------------
63
+
62
64
  def get_suite(suite_id)
63
65
  @suite[suite_id] ||= @client.send_get("get_suite/#{suite_id}")
64
66
  end
@@ -86,6 +88,7 @@ module Testrail
86
88
  end
87
89
 
88
90
  # ---------------------------------------------------> sections <---------------------------------------------------
91
+
89
92
  def get_sections(suite)
90
93
  @sections[suite['id']] ||= @client.send_get("get_sections/#{suite['project_id']}&suite_id=#{suite['id']}")
91
94
  end
@@ -113,6 +116,7 @@ module Testrail
113
116
  end
114
117
 
115
118
  # ----------------------------------------------------> cases <-----------------------------------------------------
119
+
116
120
  def find_or_create_case(title, section, depth)
117
121
  self.find_case(title, section, depth) || self.create_case(title, section['id'])
118
122
  end
@@ -130,8 +134,9 @@ module Testrail
130
134
  end
131
135
 
132
136
  # ----------------------------------------------------> runs <------------------------------------------------------
133
- def create_run(suite)
134
- @client.send_post("add_run/#{suite['project_id']}", { suite_id: suite['id'], name: "#{nice_time_now} - #{suite['name']}", description: 'describe it somehow'})
137
+
138
+ def create_run(suite, prefix=nil)
139
+ @client.send_post("add_run/#{suite['project_id']}", { suite_id: suite['id'], name: "#{prefix || nice_time_now} - #{suite['name']}", description: 'describe it somehow'})
135
140
  end
136
141
 
137
142
  def add_results_for_cases(run_id, results)
@@ -29,6 +29,7 @@ class TestrailExport < RSpec::Core::Formatters::BaseTextFormatter
29
29
  @options = RSpec.configuration.testrail_formatter_options
30
30
  @client = Testrail::Client.new(@options)
31
31
  @client.get_projects.each { |project| @project_id = project['id'] if project['name'] == @options[:project] }
32
+ @start_time_str = start_timestamp
32
33
 
33
34
  puts "TestRail Exporter [INFO] Executing #{notification.count} tests. Loaded in #{notification.load_time}"
34
35
 
@@ -162,7 +163,7 @@ class TestrailExport < RSpec::Core::Formatters::BaseTextFormatter
162
163
  end
163
164
 
164
165
  def update_test_run(suite)
165
- run_id = @client.create_run(suite.content)['id']
166
+ run_id = @client.create_run(suite.content, @start_time_str)['id']
166
167
  results = suite.each_leaf.map do |test|
167
168
  test_result = test.content[:result].execution_result
168
169
  run_time_seconds = test_result.run_time.round(0)
@@ -174,4 +175,9 @@ class TestrailExport < RSpec::Core::Formatters::BaseTextFormatter
174
175
  end
175
176
  @client.add_results_for_cases(run_id, results)
176
177
  end
178
+
179
+ def start_timestamp
180
+ # make it a bit freezed
181
+ Time.at((Time.now.to_i.to_s[0..7] + "00").to_i).strftime('%d %b %Y %R %Z')
182
+ end
177
183
  end
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "testrail_rspec"
7
7
 
8
- spec.version = '0.0.4'
8
+ spec.version = '0.0.5'
9
9
 
10
10
  spec.authors = ["Michal Kubik"]
11
11
  spec.email = ["michal.kubik@boost.no"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testrail_rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Kubik