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
-
#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
#failure ⇒ Object
Returns the value of attribute failure.
67 68 69 |
# File 'lib/ci/reporter/test_suite.rb', line 67 def failure @failure end |
#name ⇒ Object
Returns the value of attribute name
66 67 68 |
# File 'lib/ci/reporter/test_suite.rb', line 66 def name @name end |
#time ⇒ Object
Returns the value of attribute time
66 67 68 |
# File 'lib/ci/reporter/test_suite.rb', line 66 def time @time end |
Instance Method Details
#error? ⇒ Boolean
Returns non-nil if the test had an error.
85 86 87 |
# File 'lib/ci/reporter/test_suite.rb', line 85 def error? failure && failure.error? end |
#failure? ⇒ Boolean
Returns non-nil if the test failed.
80 81 82 |
# File 'lib/ci/reporter/test_suite.rb', line 80 def failure? failure && failure.failure? end |
#finish ⇒ Object
Finishes timing the test.
75 76 77 |
# File 'lib/ci/reporter/test_suite.rb', line 75 def finish self.time = Time.now - @start end |
#start ⇒ Object
Starts timing the test.
70 71 72 |
# File 'lib/ci/reporter/test_suite.rb', line 70 def start @start = Time.now end |
#to_xml(builder) ⇒ Object
Writes xml representing the test result to the provided builder.
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/ci/reporter/test_suite.rb', line 90 def to_xml(builder) attrs = {} each_pair {|k,v| attrs[k] = builder.trunc!(v.to_s) } builder.testcase(attrs) do if failure builder.failure(:type => builder.trunc!(failure.name), :message => builder.trunc!(failure.)) do builder.text!(failure.location) end end end end |