class CI::Reporter::TestCase
Structure used to represent an individual test case. Used to time the test and store the result.
Attributes
Public Class Methods
Source
# File lib/ci/reporter/test_suite.rb, line 91 def initialize(*args) super @failures = [] end
Calls superclass method
Public Instance Methods
Source
# File lib/ci/reporter/test_suite.rb, line 112 def error? failures.any?(&:error?) end
Returns non-nil if the test had an error.
Source
# File lib/ci/reporter/test_suite.rb, line 120 def error_count failures.count(&:error?) end
Source
# File lib/ci/reporter/test_suite.rb, line 107 def failure? failures.any?(&:failure?) end
Returns non-nil if the test failed.
Source
# File lib/ci/reporter/test_suite.rb, line 116 def failure_count failures.count(&:failure?) end
Source
# File lib/ci/reporter/test_suite.rb, line 102 def finish self.time = MonotonicTime.time_in_seconds - @start end
Finishes timing the test.
Source
# File lib/ci/reporter/test_suite.rb, line 97 def start @start = MonotonicTime.time_in_seconds end
Starts timing the test.
Source
# File lib/ci/reporter/test_suite.rb, line 129 def to_xml(builder) builder.testcase(cleaned_attributes) do if skipped? builder.skipped else failures.each do |failure| tag = failure.error? ? :error : :failure builder.tag!(tag, type: truncate_at_newline(failure.name), message: truncate_at_newline(failure.message)) do builder.text!(failure.message + " (#{failure.name})\n") builder.text!(failure.location) end end end end end
Writes xml representing the test result to the provided builder.