testrail_rspec 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/testrail_export/client.rb +7 -2
- data/lib/testrail_export.rb +7 -1
- data/testrail_rspec.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecca57c0223b9bae03c9b4338e6a844a38de8a07
|
4
|
+
data.tar.gz: db2f1f76f0e52296d6c73d4656a0578a7b98fd84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b004b3c593c4bc8d8431e001b68707e654d9306aa6a2ed063439ad17cfc5317363b9a8cb2f938a5ae29f9737655c770e43a1fe4f1ccd2463e03c984a838f3aa3
|
7
|
+
data.tar.gz: 914821a0f45143abd5b5dc151644d03b01b7206c4f155e0c31e104da72d6e8e4bc48193fbb67e29f1d9314031adc176e5d6ddaad3da96b7d1191fd54502511da
|
data/README.md
CHANGED
@@ -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
|
-
|
134
|
-
|
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)
|
data/lib/testrail_export.rb
CHANGED
@@ -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
|
data/testrail_rspec.gemspec
CHANGED