Class: CI::Reporter::TestCase
- Inherits:
-
Struct
- Object
- Struct
- CI::Reporter::TestCase
- Defined in:
- lib/ci/reporter/test_suite.rb
Overview
Structure used to represent an individual test case. Used to time the test and store the result.
Instance Attribute Summary collapse
-
#assertions ⇒ Object
Returns the value of attribute assertions.
-
#failure ⇒ Object
Returns the value of attribute failure.
-
#name ⇒ Object
Returns the value of attribute name.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
-
#error? ⇒ Boolean
Returns non-nil if the test had an error.
-
#failure? ⇒ Boolean
Returns non-nil if the test failed.
-
#finish ⇒ Object
Finishes timing the test.
-
#start ⇒ Object
Starts timing the test.
-
#to_xml(builder) ⇒ Object
Writes xml representing the test result to the provided builder.
Instance Attribute Details
#assertions ⇒ Object
Returns the value of attribute assertions
114 115 116 |
# File 'lib/ci/reporter/test_suite.rb', line 114 def assertions @assertions end |
#failure ⇒ Object
Returns the value of attribute failure.
115 116 117 |
# File 'lib/ci/reporter/test_suite.rb', line 115 def failure @failure end |
#name ⇒ Object
Returns the value of attribute name
114 115 116 |
# File 'lib/ci/reporter/test_suite.rb', line 114 def name @name end |
#time ⇒ Object
Returns the value of attribute time
114 115 116 |
# File 'lib/ci/reporter/test_suite.rb', line 114 def time @time end |
Instance Method Details
#error? ⇒ Boolean
Returns non-nil if the test had an error.
133 134 135 |
# File 'lib/ci/reporter/test_suite.rb', line 133 def error? failure && failure.error? end |
#failure? ⇒ Boolean
Returns non-nil if the test failed.
128 129 130 |
# File 'lib/ci/reporter/test_suite.rb', line 128 def failure? failure && failure.failure? end |
#finish ⇒ Object
Finishes timing the test.
123 124 125 |
# File 'lib/ci/reporter/test_suite.rb', line 123 def finish self.time = Time.now - @start end |
#start ⇒ Object
Starts timing the test.
118 119 120 |
# File 'lib/ci/reporter/test_suite.rb', line 118 def start @start = Time.now end |
#to_xml(builder) ⇒ Object
Writes xml representing the test result to the provided builder.
138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/ci/reporter/test_suite.rb', line 138 def to_xml(builder) attrs = {} each_pair {|k,v| attrs[k] = builder.trunc!(v.to_s) unless v.nil? || v.to_s.empty?} builder.testcase(attrs) do if failure builder.failure(:type => builder.trunc!(failure.name), :message => builder.trunc!(failure.)) do builder.text!(failure. + " (#{failure.name})\n") builder.text!(failure.location) end end end end |