| Class | CI::Reporter::TestCase |
| In: |
lib/ci/reporter/test_suite.rb
|
| Parent: | Struct.new(:name, :time, :assertions) |
Structure used to represent an individual test case. Used to time the test and store the result.
| failures | [RW] | |
| skipped | [RW] |
# File lib/ci/reporter/test_suite.rb, line 104
104: def initializeinitialize(*args)
105: super
106: @failures = []
107: end
Returns non-nil if the test had an error.
# File lib/ci/reporter/test_suite.rb, line 125
125: def error?
126: !failures.empty? && failures.detect {|f| f.error? }
127: end
Returns non-nil if the test failed.
# File lib/ci/reporter/test_suite.rb, line 120
120: def failure?
121: !failures.empty? && failures.detect {|f| f.failure? }
122: end
Finishes timing the test.
# File lib/ci/reporter/test_suite.rb, line 115
115: def finish
116: self.time = Time.now - @start
117: end
Starts timing the test.
# File lib/ci/reporter/test_suite.rb, line 110
110: def start
111: @start = Time.now
112: end
Writes xml representing the test result to the provided builder.
# File lib/ci/reporter/test_suite.rb, line 134
134: def to_xml(builder)
135: attrs = {}
136: each_pair {|k,v| attrs[k] = builder.trunc!(v.to_s) unless v.nil? || v.to_s.empty?}
137: builder.testcase(attrs) do
138: if skipped
139: builder.skipped
140: else
141: failures.each do |failure|
142: builder.failure(:type => builder.trunc!(failure.name), :message => builder.trunc!(failure.message)) do
143: builder.text!(failure.message + " (#{failure.name})\n")
144: builder.text!(failure.location)
145: end
146: end
147: end
148: end
149: end