test_rail_integration 0.0.7.5 → 0.0.7.6

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: e23e9787ab227680d64e6260417202facbef45f8
4
- data.tar.gz: eea9783e6858a99f2930ebeb311108d21aecdfc9
3
+ metadata.gz: 68e2e802b05ca5fc3348c0066b4263cd0ebe4239
4
+ data.tar.gz: ad2d2bce95f4c4a864f2b0878a83ece1e2b99373
5
5
  SHA512:
6
- metadata.gz: 381ea1e6478b8c36a0fc724ed1d2441f2117be26fccae96ee878054fd3d4192eb252ce2649e4b34f9c8978266b37ecf68a4b0b2ec89a3bd27a40c68e6dcebc57
7
- data.tar.gz: 2fc1a474e3d9c3c4718eb7cb78da81297cceadf65f76fa35784f59aaa2c8a5029a4f4efb180969d1c18f3ebd335a86a8055ebdb51ebf34a8e391579cbeed86aa
6
+ metadata.gz: 75586819186d4a947ed3b13727b0a238bef0204161b7cd3c5145ae78dd3a2e8fbd5c50c8add87e7e81b83adc1dc0c02fb121c945ecd617ddf369cdb387376449
7
+ data.tar.gz: 920b43708ca454b0295bf32d41859c13daa9b08ecdd9bf5196d78a08d77dbaad6bfd1d202e4dab900fe3e36792471718ac132021e9b322529f24606481219a81
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'thor'
4
- gem 'fileutils'
4
+ gem 'fileutils'
5
+ gem 'rspec'
data/Gemfile.lock CHANGED
@@ -1,9 +1,23 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
+ diff-lcs (1.2.5)
4
5
  fileutils (0.7)
5
6
  rmagick (>= 2.13.1)
6
7
  rmagick (2.13.4)
8
+ rspec (3.2.0)
9
+ rspec-core (~> 3.2.0)
10
+ rspec-expectations (~> 3.2.0)
11
+ rspec-mocks (~> 3.2.0)
12
+ rspec-core (3.2.1)
13
+ rspec-support (~> 3.2.0)
14
+ rspec-expectations (3.2.0)
15
+ diff-lcs (>= 1.2.0, < 2.0)
16
+ rspec-support (~> 3.2.0)
17
+ rspec-mocks (3.2.1)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.2.0)
20
+ rspec-support (3.2.2)
7
21
  thor (0.19.1)
8
22
 
9
23
  PLATFORMS
@@ -11,4 +25,5 @@ PLATFORMS
11
25
 
12
26
  DEPENDENCIES
13
27
  fileutils
28
+ rspec
14
29
  thor
@@ -0,0 +1,30 @@
1
+ :connection_data:
2
+ :url: https://mlp.testrail.com
3
+ :username: Twilight
4
+ :password: Sparkle
5
+
6
+ :project: 2 # Test project id can be found in Test Rail
7
+ :test_suite: 63 # Test suite id can be found in Test Rail
8
+ :assigned_to: 27 # Id of person could be found in Test Rail
9
+ :description_of_run: "Automatically generated report by auto tests."
10
+
11
+ :status_comment: 0
12
+ :test_pass: 1
13
+ :need_to_retest: 4
14
+ :test_failed: 5
15
+ :new_test: 0
16
+
17
+ :test_passed_comment: "test **passed:**"
18
+ :test_failed_comment: "test **failed:**"
19
+
20
+ :ventures: vn|id|ph|my|sg|th|all #values for generating parametrized url for running test
21
+ :environments: live_test|staging|showroom #values for generating parametrized url for running test
22
+
23
+ :in_progress: " (in progress)" #value for changing test run name for monitoring complete of test run
24
+
25
+ :test_run_id: 513
26
+
27
+ :exec_command: "cucumber -p lazada.#{parameters.venture}.#{parameters.environment} TESTRAIL=1 --format AllureCucumber::Formatter DRIVER=grid SELENIUM_GRID_SERVER_URL=http://192.168.100.1:4444/wd/hub -t "
28
+
29
+ :types: 4 #types for filtering from Test Rail
30
+
@@ -6,8 +6,12 @@ module TestRailIntegration
6
6
  desc "perform", "Creates project for interaction with TestRail"
7
7
 
8
8
  def perform
9
- TestRailIntegration::TestTail::Generators::Project.copy_file('run_test_run.rb')
10
- TestRailIntegration::TestTail::Generators::Project.copy_file("test_rail_data.yml", "config/data/")
9
+ TestRailIntegration::TestRail::Generators::Project.copy_file('run_test_run.rb')
10
+ TestRailIntegration::TestRail::Generators::Project.copy_file("test_rail_data.yml", "config/data/")
11
+ end
12
+
13
+ def check_test_run_and_update
14
+ check
11
15
  end
12
16
  end
13
17
  end
@@ -150,6 +150,10 @@ module TestRail
150
150
  case_ids
151
151
  end
152
152
 
153
+ def self.get_case_info(case_id)
154
+ client.send_get("get_case/#{case_id}")
155
+ end
156
+
153
157
  #
154
158
  # Changing name of test run from <test run name> in progress to <test run name>
155
159
  #
@@ -0,0 +1,34 @@
1
+ require_relative '../../generator/test_rail_data_load'
2
+ require_relative '../../generator/API_client'
3
+ require_relative '../../generator/connection'
4
+ require_relative '../../generator/test_rail_tools'
5
+
6
+
7
+ module TestRail
8
+
9
+ class CheckTestRun
10
+
11
+ def check
12
+ test_cases_id = Connection.cases_with_types
13
+ test_cases_id.each do |test_case|
14
+
15
+ test_results = Connection.get_test_result(test_case).map { |status_hash| status_hash["status_id"] }
16
+ if test_results.include?(TestCaseResult::COMMENT[:fail][:status]) && test_results.include?(TestCaseResult::COMMENT[:pass][:status])
17
+ fail_indexes = Connection.get_indexes_of_fails(test_case)
18
+ pass_indexes = Connection.get_test_result(test_case).map.with_index { |result, index| result["status_id"] == TestCaseResult::COMMENT[:pass][:status] ? index : nil }
19
+ pass_indexes.compact!
20
+
21
+ if pass_indexes.first < fail_indexes.first
22
+ scenario = Connection.get_case_info(test_case)
23
+ test_case_result = TestRail::TestCaseResult.new(test_case, scenario['title'])
24
+ test_case_result.comment ||= TestRail::TestCaseResult::COMMENT[:fail]
25
+ TestRail::Connection.commit_test_result(test_case_result)
26
+
27
+ return test_case_result
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ end
34
+ end
@@ -8,8 +8,8 @@ require 'test_rail_integration/generator/test_run_creation'
8
8
  require 'test_rail_integration/generator/test_rail_tools'
9
9
 
10
10
  module TestRail
11
- unless TestRailIntegration::TestTail::Generators::Project.test_rail_data_file_exist?
12
- TestRailIntegration::TestTail::Generators::Project.copy_file("test_rail_data.yml")
11
+ unless TestRailIntegration::TestRail::Generators::Project.test_rail_data_file_exist?
12
+ TestRailIntegration::TestRail::Generators::Project.copy_file("test_rail_data.yml")
13
13
  raise "Please fill all required data in test rail data yml file"
14
14
  end
15
15
 
@@ -2,7 +2,7 @@ require 'fileutils'
2
2
  require 'thor/group'
3
3
 
4
4
  module TestRailIntegration
5
- module TestTail
5
+ module TestRail
6
6
  module Generators
7
7
  class Project < Thor::Group
8
8
  include Thor::Actions
@@ -1,3 +1,3 @@
1
1
  module TestRailIntegration
2
- VERSION = "0.0.7.5"
2
+ VERSION = "0.0.7.6"
3
3
  end
@@ -0,0 +1,21 @@
1
+ require 'rspec'
2
+ require_relative '../lib/test_rail_integration/generator/connection'
3
+ require_relative '../lib/test_rail_integration/generator/project/check_test_run'
4
+
5
+ describe 'Checking test run' do
6
+
7
+ context 'when last result is pass but we already have fail results' do
8
+
9
+ it 'should change status to fail' do
10
+
11
+ allow(TestRail::Connection).to receive(:cases_with_types).and_return([1011])
12
+ allow(TestRail::Connection).to receive(:get_test_result).and_return([{"status_id" => 1, :comment => "FTW"}, {"status_id" => 5, :comment => "Burn heretics"}])
13
+ allow(TestRail::Connection).to receive(:get_case_info).and_return({id: 1011, "title" => 'MLP'})
14
+ allow(TestRail::Connection).to receive(:commit_test_result).and_return([])
15
+
16
+ test_case_result = TestRail::CheckTestRun.new.check
17
+ expect(test_case_result.title).to eq('MLP')
18
+ expect(test_case_result.comment).to eq({:status => 5, :comment => "test **failed:**"})
19
+ end
20
+ end
21
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_rail_integration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7.5
4
+ version: 0.0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirikami
@@ -81,6 +81,7 @@ files:
81
81
  - README.md
82
82
  - Rakefile
83
83
  - bin/test_rail_integration
84
+ - config/data/test_rail_data.yml
84
85
  - doc/Gemfile.html
85
86
  - doc/Gemfile_lock.html
86
87
  - doc/LICENSE_txt.html
@@ -167,6 +168,7 @@ files:
167
168
  - lib/test_rail_integration/generator/API_client.rb
168
169
  - lib/test_rail_integration/generator/connection.rb
169
170
  - lib/test_rail_integration/generator/project.rb
171
+ - lib/test_rail_integration/generator/project/check_test_run.rb
170
172
  - lib/test_rail_integration/generator/project/run_test_run.rb
171
173
  - lib/test_rail_integration/generator/project/test_rail_data.yml
172
174
  - lib/test_rail_integration/generator/test_case_result.rb
@@ -176,6 +178,7 @@ files:
176
178
  - lib/test_rail_integration/generator/test_run_creation.rb
177
179
  - lib/test_rail_integration/generator/test_run_parameters.rb
178
180
  - lib/test_rail_integration/version.rb
181
+ - spec/check_test_run_spec.rb
179
182
  - test_rail_integration.gemspec
180
183
  homepage: https://github.com/Kirikami/test_rail_integration
181
184
  licenses:
@@ -201,4 +204,5 @@ rubygems_version: 2.4.5
201
204
  signing_key:
202
205
  specification_version: 4
203
206
  summary: Gem for integration between framework and TestRail API
204
- test_files: []
207
+ test_files:
208
+ - spec/check_test_run_spec.rb