ocunit2junit 1.1 → 1.2

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.
Files changed (2) hide show
  1. data/bin/ocunit2junit +27 -6
  2. metadata +3 -3
@@ -20,6 +20,7 @@
20
20
  #
21
21
  # Where to put the XML-files from your unit tests
22
22
  TEST_REPORTS_FOLDER = "test-reports"
23
+ SUPPORT_KIWI = true
23
24
  #
24
25
  #
25
26
  # Don't edit below this line
@@ -47,11 +48,18 @@ class ReportParser
47
48
  def parse_input
48
49
  @piped_input.each do |piped_row|
49
50
  puts piped_row
51
+
52
+ description_results = piped_row.scan(/\s\'(.+)\'\s/)
53
+ if description_results and description_results[0] and description_results[0]
54
+ description = description_results[0][0]
55
+ end
56
+
50
57
  case piped_row
51
58
 
52
59
  when /Test Suite '(\S+)'.*started at\s+(.*)/
53
60
  t = Time.parse($2.to_s)
54
61
  handle_start_test_suite(t)
62
+ @last_description = nil
55
63
 
56
64
  when /Test Suite '(\S+)'.*finished at\s+(.*)./
57
65
  t = Time.parse($2.to_s)
@@ -59,24 +67,25 @@ class ReportParser
59
67
 
60
68
  when /Test Case '-\[\S+\s+(\S+)\]' started./
61
69
  test_case = $1
70
+ @last_description = nil
62
71
 
63
72
  when /Test Case '-\[\S+\s+(\S+)\]' passed \((.*) seconds\)/
64
- test_case = $1
73
+ test_case = get_test_case_name($1, @last_description)
65
74
  test_case_duration = $2.to_f
66
75
  handle_test_passed(test_case,test_case_duration)
67
76
 
68
77
  when /(.*): error: -\[(\S+) (\S+)\] : (.*)/
69
78
  error_location = $1
70
79
  test_suite = $2
71
- test_case = $3
72
80
  error_message = $4
73
- handle_test_error(test_suite,test_case,error_message,error_location)
74
-
81
+ test_case = get_test_case_name($3, description)
82
+ handle_test_error(test_suite,test_case,error_message,error_location)
83
+
75
84
  when /Test Case '-\[\S+ (\S+)\]' failed \((\S+) seconds\)/
76
- test_case = $1
85
+ test_case = get_test_case_name($1, @last_description)
77
86
  test_case_duration = $2.to_f
78
87
  handle_test_failed(test_case,test_case_duration)
79
-
88
+
80
89
  when /failed with exit code (\d+)/
81
90
  @exit_code = $1.to_i
82
91
 
@@ -84,6 +93,10 @@ class ReportParser
84
93
  /BUILD FAILED/
85
94
  @exit_code = -1;
86
95
  end
96
+
97
+ unless description.nil?
98
+ @last_description = description
99
+ end
87
100
  end
88
101
  end
89
102
 
@@ -150,6 +163,14 @@ class ReportParser
150
163
  @total_failed_test_cases +=1
151
164
  @tests_results[test_case] = test_case_duration
152
165
  end
166
+
167
+ def get_test_case_name(test_case, description)
168
+ if SUPPORT_KIWI and test_case == "example" and !description.nil?
169
+ description
170
+ else
171
+ test_case
172
+ end
173
+ end
153
174
 
154
175
  end
155
176
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocunit2junit
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: '1.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-02 00:00:00.000000000 Z
12
+ date: 2012-11-13 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'Simply pipe your xcodebuild output through ocunit2junit: xcodebuild
15
15
  ... | ocunit2junit.rb'
@@ -43,5 +43,5 @@ rubyforge_project:
43
43
  rubygems_version: 1.8.24
44
44
  signing_key:
45
45
  specification_version: 3
46
- summary: A script that converts OCUnit output to JUnit style XML output.
46
+ summary: A script that converts OCUnit (and Kiwi) output to JUnit style XML output.
47
47
  test_files: []