testrail-cucumber 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e52824586ee4675bc995e0c28f935172ffb1e3b06e7d69885c6ed65322e37ad9
4
- data.tar.gz: e7b2c076391f286b66c5f6aaad6a2d201e22235121fbbd0f28255713ba0954a8
3
+ metadata.gz: d907c311d0f9fa65fce84b2732810fe3f4a3e8b05f5dda4b13751a13e048491b
4
+ data.tar.gz: e84848a9018ca24f8e85bdc97d2f3934f895b48cc92f048ab57bc95887b4d114
5
5
  SHA512:
6
- metadata.gz: ebdf33970bbe97e53ec5a790646e58afd69543b5b645a0a5f5ea62efeba141a529859210056305713cf8e79e890dde0b363a422f45f3b92a4cb22366244811e8
7
- data.tar.gz: 40a24b38aaf2a56bd75321bb64eb95756384da1205ab69cad3ed1c1a8434ead374648c98fa87a3036cdc687b309516cff9dc777399e47587a60d469bb94285fc
6
+ metadata.gz: 713d16f3410216944ddba29e3d78227ec3888f56cc747fa151a348402d52aa3e0f1dd84d5e230873f237709dd0cca8fc6558a54a1854ef0842c2a628b15ee657
7
+ data.tar.gz: e9315fff6966f8ec9bb41399527995910849cac1cbaecea7cc3b22a9017f8ffee1fe733457a65900045720ff49dcf6d2534382752d1815e9e14b44a953ffe291
@@ -62,6 +62,11 @@ module TestRail
62
62
  _send_request('POST', uri, data)
63
63
  end
64
64
 
65
+ def create_test_run(uri, data)
66
+ @add_test = true
67
+ _send_request('POST', uri, data)
68
+ end
69
+
65
70
  private
66
71
  def _send_request(method, uri, data)
67
72
  url = URI.parse(@url + uri)
@@ -83,20 +88,21 @@ module TestRail
83
88
 
84
89
  if response.body && !response.body.empty?
85
90
  result = JSON.parse(response.body)
91
+ return result['id'] if @add_test
86
92
  else
87
93
  result = {}
88
94
  end
89
95
 
90
- if response.code != '200'
96
+ if (response.code != '200') && response.code != '400'
91
97
  if result && result.key?('error')
92
98
  error = '"' + result['error'] + '"'
93
99
  else
94
100
  error = 'No additional error message received'
95
101
  end
96
102
  raise APIError.new('TestRail API returned HTTP %s (%s)' %
97
- [response.code, error])
103
+ [response.code, error])
104
+ elsif response.code == '400'
98
105
  end
99
-
100
106
  result
101
107
  end
102
108
  end
@@ -20,17 +20,26 @@ module TestrailCucumber
20
20
  def upload_result
21
21
 
22
22
  response = {}
23
- case_id = @scenario.name.split(' ').first.scan(/\d+/).first rescue nil
23
+
24
+ case_list = []
25
+ @scenario.name.split(' ').map do |e|
26
+ val = e.scan(/\d+/).first
27
+ next if val.nil?
28
+ case_list << val
29
+ end
30
+
31
+ return if case_list.empty?
32
+
24
33
  status_id = get_status_id @scenario.status
25
- run_id = @config['run_id']
26
-
27
- if case_id && run_id
34
+ @run_id ||= @config['run_id']
35
+ @run_id = @@run_id rescue @@run_id = nil unless @config['run_id']
36
+ @run_id = @@run_id = client.create_test_run("add_run/#{@config['project_id']}", { "suite_id": @config['suite_id']}) if @run_id.nil?
37
+
38
+ case_list.map do |case_id|
28
39
  response = client.send_post(
29
- "add_result_for_case/#{run_id}/#{case_id}",
40
+ "add_result_for_case/#{@run_id}/#{case_id}",
30
41
  { status_id: status_id }
31
42
  )
32
- else
33
- raise 'unable to get case id or run id'
34
43
  end
35
44
 
36
45
  response
@@ -1,3 +1,3 @@
1
1
  module TestrailCucumber
2
- VERSION = '0.1.7'.freeze
2
+ VERSION = '0.1.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,15 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testrail-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prashanth Sams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-25 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2020-02-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: cucumber
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: selenium-webdriver
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '11.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '11.0'
13
97
  description:
14
98
  email:
15
99
  - sams.prashanth@gmail.com
@@ -21,7 +105,7 @@ files:
21
105
  - lib/testrail-cucumber/api-client.rb
22
106
  - lib/testrail-cucumber/update-testrails.rb
23
107
  - lib/testrail-cucumber/version.rb
24
- homepage:
108
+ homepage: https://github.com/prashanth-sams/testrail-cucumber
25
109
  licenses:
26
110
  - MIT
27
111
  metadata:
@@ -43,9 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
43
127
  - !ruby/object:Gem::Version
44
128
  version: '0'
45
129
  requirements: []
46
- rubyforge_project:
47
- rubygems_version: 2.7.8
130
+ rubygems_version: 3.0.4
48
131
  signing_key:
49
132
  specification_version: 4
50
- summary: Sync automation results with your testrail suite
133
+ summary: Sync cucumber automation test results with your testrail suite
51
134
  test_files: []