watir_testlink_framework 0.0.6 → 0.0.7

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: 354b2c35ba2e93a9178cda0ebe21c6c4d9f7ae06
4
- data.tar.gz: a463aa2a136d74a4db44780ff3182243bfcde1b9
3
+ metadata.gz: 158a06042f03c1dc83a97908ec2dcb2353969876
4
+ data.tar.gz: 16765ce4ed663d508cc73f2a99169396c0bd881c
5
5
  SHA512:
6
- metadata.gz: 0ae77c8dc94a178f036c7e0a9042f72079e009a161b496ece0995462a7ced034c918a483bb37041b315b59a2564ba99b044cb54b9fdd338243b4ad70b022c0f4
7
- data.tar.gz: 79993f21af3dd42c6f4bf62465c4b3afa6b00f7b1743af751ef1426c47caf2d5f566c8b0d4308eef32742b7b67ee04f23344b144c6018a43388e06f872a3a6fd
6
+ metadata.gz: ef9f3086b3e419b0c460d63388797ddd7d563553f698e8b37400ead244a31f68fc77af9e858a13d9b89a4c61fbdb97440d2044edd6ad9add22f1638000216a0b
7
+ data.tar.gz: 16cf3c20f683b2ef7b9e8f0759ea233a7b7bf097100f150d3dfa5f82862c2b0bd8af6fe1f9eeb1bedadb8f4bd49ba8067d5195a0853567d7f14326ccc43c1fcc
@@ -1,5 +1,9 @@
1
1
  # CHANGLOG
2
2
 
3
+ # v0.0.7 - 2015-01-29
4
+ * report per testcase
5
+ * catch report exception
6
+
3
7
  # v0.0.6 - 2015-01-28
4
8
  * build per environment
5
9
 
@@ -45,27 +45,28 @@ module WatirTestlinkFramework
45
45
  $config['testlink']['testplans'][plan.strip].each do | envname, envarr |
46
46
 
47
47
  #create new build
48
- buildname = "build_#{envname}_#{Time.new}"
48
+ buildname = "build_#{Time.new}_#{envname}"
49
49
  tl.create_build(plan_id, buildname, 'created by watir_testlink_framework')
50
50
 
51
+ ### REPORT PER CASE
51
52
  envstr = make_env_string(envarr)
52
- self.execute_cases(tl, envstr, spectask, test_cases, dryrun)
53
- self.report_cases(tl, plan_id, test_cases, envstr) if spectask=='junit' && !dryrun
53
+ self.execute_cases(tl,plan_id,envstr, spectask, test_cases, dryrun)
54
+ # self.report_cases(tl, plan_id, test_cases, envstr) if spectask=='junit' && !dryrun
54
55
  end
55
56
 
56
57
  else
57
58
  buildname = "build_#{Time.new}"
58
59
  tl.create_build(plan_id, buildname, 'created by watir_testlink_framework')
59
60
  envstr = make_env_string($config['testlink']['testplans'][plan.strip])
60
- self.execute_cases(tl, envstr, spectask, test_cases, dryrun)
61
- self.report_cases(tl, plan_id, test_cases, envstr) if spectask=='junit' && !dryrun
61
+ self.execute_cases(tl, plan_id, envstr, spectask, test_cases, dryrun)
62
+ # self.report_cases(tl, plan_id, test_cases, envstr) if spectask=='junit' && !dryrun
62
63
  end
63
64
 
64
65
  end
65
66
 
66
67
  end
67
68
 
68
- def self.execute_cases(tl, envstr,spectask, test_cases,dryrun)
69
+ def self.execute_cases(tl, plan_id, envstring, spectask, test_cases, dryrun)
69
70
  test_cases.each do |tc|
70
71
 
71
72
  tc_customfield = tl.test_case_custom_field_design_value(tl.project_id($config['testlink']['project']),
@@ -73,11 +74,22 @@ module WatirTestlinkFramework
73
74
  tc[1][0]['version'].to_i,
74
75
  'RSPEC CASE ID',{:details=>''})
75
76
 
76
- exec_string = "#{envstr}bundle exec rake testlink:#{spectask} SPEC_OPTS=\"-e #{tc_customfield}\""
77
+ exec_string = "#{envstring}bundle exec rake testlink:#{spectask} SPEC_OPTS=\"-e #{tc_customfield}\""
77
78
  if dryrun
78
79
  puts exec_string
79
80
  else
81
+ print "\nRunning testcase #{tc_customfield} with ENV: #{envstring}\n"
80
82
  system exec_string
83
+ print "Reporting testcase #{tc_customfield}\n"
84
+
85
+ begin
86
+ self.report_a_case(tl, plan_id, tc, envstring) if spectask=='junit'
87
+ rescue Exception => e
88
+ print "EXCEPTION------------------------------------\n"
89
+ puts e.message
90
+ puts e.backtrace.inspect
91
+ end
92
+
81
93
  end
82
94
  end
83
95
  end
@@ -90,41 +102,56 @@ module WatirTestlinkFramework
90
102
  return envstr
91
103
  end
92
104
 
93
- def self.report_cases(tl, plan_id, cases, envstring)
105
+ def self.read_report_array
94
106
  cases_arr ={}
95
- require 'pp'
96
107
  Dir["reports/*.xml"].each do | report |
97
108
  case_arr = XmlSimple::xml_in(report)
98
109
  cases_arr[case_arr['testcase'][0]['name']] = case_arr
99
110
  end
111
+ return cases_arr
112
+ end
100
113
 
101
- cases.each do | tc |
102
- tc_customfield = tl.test_case_custom_field_design_value(tl.project_id($config['testlink']['project']),
103
- tc[1][0]['full_external_id'],
104
- tc[1][0]['version'].to_i,
105
- 'RSPEC CASE ID',{:details=>''})
106
- if cases_arr.has_key?(tc_customfield)
107
- options = {}
108
- notes=''
109
- if cases_arr[tc_customfield]['failures'] == '0'
110
- status ='p'
111
- elsif cases_arr[tc_customfield]['failures'] == '1'
112
- notes += "Message: " + cases_arr[tc_customfield]['testcase'][0]['failure'][0]['message']
113
- notes += "\n"
114
- notes += "Type: " + cases_arr[tc_customfield]['testcase'][0]['failure'][0]['type']
115
- notes += "\n"
116
- notes += "Content: " + cases_arr[tc_customfield]['testcase'][0]['failure'][0]['content']
117
- notes += "\n"
118
- notes += "EnvString: " + envstring
119
- status ='f'
120
- else
121
- status = 'b'
122
- end
123
-
124
- options['notes'] = notes
125
- tl.report_test_case_result(plan_id, tc[0], status, options)
114
+ def self.report_a_case(tl, plan_id, tc, envstring)
115
+
116
+ cases_arr = self.read_report_array
117
+
118
+ tc_customfield = tl.test_case_custom_field_design_value(tl.project_id($config['testlink']['project']),
119
+ tc[1][0]['full_external_id'],
120
+ tc[1][0]['version'].to_i,
121
+ 'RSPEC CASE ID',{:details=>''})
122
+ if cases_arr.has_key?(tc_customfield)
123
+ options = {}
124
+ notes=''
125
+ if cases_arr[tc_customfield]['failures'] == '0'
126
+ status ='p'
127
+ elsif cases_arr[tc_customfield]['failures'] == '1'
128
+ notes += "Message: " + cases_arr[tc_customfield]['testcase'][0]['failure'][0]['message']
129
+ notes += "\n"
130
+ notes += "Type: " + cases_arr[tc_customfield]['testcase'][0]['failure'][0]['type']
131
+ notes += "\n"
132
+ notes += "Content: " + cases_arr[tc_customfield]['testcase'][0]['failure'][0]['content']
133
+ notes += "\n"
134
+ notes += "EnvString: " + envstring
135
+ status ='f'
136
+ else
137
+ status = 'b'
126
138
  end
127
139
 
140
+ options['notes'] = notes
141
+ tl.report_test_case_result(plan_id, tc[0], status, options)
142
+ end
143
+
144
+ end
145
+
146
+ def self.report_cases(tl, plan_id, cases, envstring)
147
+ cases_arr ={}
148
+ Dir["reports/*.xml"].each do | report |
149
+ case_arr = XmlSimple::xml_in(report)
150
+ cases_arr[case_arr['testcase'][0]['name']] = case_arr
151
+ end
152
+
153
+ cases.each do | tc |
154
+ self.report_a_case(tl, plan_id, tc, envstring)
128
155
  end
129
156
  end
130
157
 
@@ -1,3 +1,3 @@
1
1
  module WatirTestlinkFramework
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir_testlink_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pim Snel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-28 00:00:00.000000000 Z
11
+ date: 2015-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler