cukerail 0.7.2 → 0.7.3

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
  SHA1:
3
- metadata.gz: 24bae7abdae14674f015a792e0fc8a9ea6f05ec5
4
- data.tar.gz: 48845f5c09974f288294523f4433f416b83fe081
3
+ metadata.gz: 71308b92fe0b602b84883e2293b7ebd3c27d366f
4
+ data.tar.gz: 31e3b544466ea24d09cccad40d5b9af2c57cc08d
5
5
  SHA512:
6
- metadata.gz: a9b818a301123b8ff784455e6dd76bbe3ea14cb48f432cff150c0bbf1963408d625d353bdcd102a20a13a1b32da5f6e8e6ab5655b0276774a8f9dedf6e58a39e
7
- data.tar.gz: a2710b96fe577e67c8b65a7f8a78d04e67a934fca2e05a3ccb9624f006b60d12ea7c962b04d448b51435432dd245825a220ef45a4d4fb99d46a4d6ec9166887d
6
+ metadata.gz: 4e00468b852392bbe8c1312ce3906f6337d19978e163226353d3ccd347c2c638f134db403fe4c7739047f2f4cfef4170ce79d4afe289504f3d7b3a2fda154d4a
7
+ data.tar.gz: d4ac59453711286e7dba7fd4d4d0671d261c7547776299c55be2799eac92fed471986bcdda94306e6fe734c3d83f54b0a84448f0b66919133c60bd94a3b63f8d
@@ -1,3 +1,3 @@
1
1
  module Cukerail
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
@@ -19,23 +19,31 @@ module Cukerail
19
19
  end
20
20
 
21
21
  def load
22
- results.children.each do |child|
23
- recurse_down(child)
24
- end
22
+ recurse_down(results)
25
23
  end
26
24
 
27
25
  def recurse_down(element,level=0,parent_id=nil)
28
- element.children.select{|n| n.name=='testcase'}.each do |testcase|
29
- case_id = get_testcase_id(testcase,parent_id)
30
- report_result(case_id,testcase) if run_id
31
- end
32
- element.children.select{|n| n.name=='testsuite'}.each do |testsuite|
33
- section_id = get_section_id(testsuite,parent_id) if testsuite.attributes['name'].value.size > 0
34
- recurse_down(testsuite,level+1,(section_id || parent_id))
35
- end
26
+ if element.name == 'document'
27
+ element.children.each do |child|
28
+ recurse_down(child)
29
+ end
30
+ end
31
+ if element.name == 'testsuite'
32
+ section_id = get_section_id(element,parent_id)
33
+ end
34
+ element.children.select{|n| n.name=='testsuite'}.each do |testsuite|
35
+ recurse_down(testsuite,level+1,(section_id || parent_id))
36
+ end
37
+ element.children.select{|n| n.name=='testcase'}.each do |testcase|
38
+ case_id = get_testcase_id(testcase,(section_id || parent_id))
39
+ report_result(case_id,testcase) if run_id
40
+ end
36
41
  end
37
42
 
43
+ #return nil if a section cannot be fouind or created
38
44
  def get_section_id(testsuite,parent_id=nil)
45
+ # some elements don't have names
46
+ return nil if testsuite.attributes['name'].value.empty?
39
47
  section = sections.detect{|s| s['name'] == testsuite.attributes['name'].value}
40
48
  unless section
41
49
  section = testrail_api_client.send_post("add_section/#{project_id}",{suite_id:suite_id,name:testsuite.attributes['name'].value,parent_id:parent_id})
@@ -53,14 +61,14 @@ module Cukerail
53
61
  end
54
62
 
55
63
  def get_testcase_id(testcase,section_id)
56
- unless testcases[section_id]
57
- testcases[section_id] = testrail_api_client.send_get("get_cases/#{project_id}&suite_id=#{suite_id}&section_id=#{section_id}")
58
- end
59
- unless testcases[section_id].detect{|tc| tc['title'] == testcase.attributes['name'].value}
60
- new_tc = testrail_api_client.send_post("add_case/#{section_id}",{title:testcase.attributes['name'].value,type_id:1})
61
- testcases[section_id] << new_tc
62
- end
63
- testcases[section_id].detect{|tc| tc['title'] == testcase.attributes['name'].value}['id']
64
+ unless testcases[section_id]
65
+ testcases[section_id] = testrail_api_client.send_get("get_cases/#{project_id}&suite_id=#{suite_id}&section_id=#{section_id}")
66
+ end
67
+ unless testcases[section_id].detect{|tc| tc['title'] == testcase.attributes['name'].value}
68
+ new_tc = testrail_api_client.send_post("add_case/#{section_id}",{title:testcase.attributes['name'].value,type_id:1})
69
+ testcases[section_id] << new_tc
70
+ end
71
+ testcases[section_id].detect{|tc| tc['title'] == testcase.attributes['name'].value}['id']
64
72
  end
65
73
 
66
74
  def report_result(case_id,testcase)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cukerail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Small
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-18 00:00:00.000000000 Z
11
+ date: 2016-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber