Class: CI::Reporter::TestUnit
- Inherits:
-
Test::Unit::UI::TestRunnerMediator
- Object
- Test::Unit::UI::TestRunnerMediator
- CI::Reporter::TestUnit
- Defined in:
- lib/ci/reporter/test_unit.rb
Overview
Replacement Mediator that adds listeners to capture the results of the Test::Unit
runs.
Instance Method Summary collapse
- #fault(fault) ⇒ Object
- #finished(elapsed_time) ⇒ Object
-
#initialize(suite, report_mgr = nil) ⇒ TestUnit
constructor
A new instance of TestUnit.
- #started(result) ⇒ Object
- #test_finished(name) ⇒ Object
- #test_started(name) ⇒ Object
Constructor Details
#initialize(suite, report_mgr = nil) ⇒ TestUnit
Returns a new instance of TestUnit.
45 46 47 48 49 50 51 52 53 |
# File 'lib/ci/reporter/test_unit.rb', line 45 def initialize(suite, report_mgr = nil) super(suite) @report_manager = report_mgr || ReportManager.new("test") add_listener(Test::Unit::UI::TestRunnerMediator::STARTED, &method(:started)) add_listener(Test::Unit::TestCase::STARTED, &method(:test_started)) add_listener(Test::Unit::TestCase::FINISHED, &method(:test_finished)) add_listener(Test::Unit::TestResult::FAULT, &method(:fault)) add_listener(Test::Unit::UI::TestRunnerMediator::FINISHED, &method(:finished)) end |
Instance Method Details
#fault(fault) ⇒ Object
76 77 78 79 |
# File 'lib/ci/reporter/test_unit.rb', line 76 def fault(fault) tc = @current_suite.testcases.last tc.failures << Failure.new(fault) end |
#finished(elapsed_time) ⇒ Object
81 82 83 |
# File 'lib/ci/reporter/test_unit.rb', line 81 def finished(elapsed_time) finish_suite end |
#started(result) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/ci/reporter/test_unit.rb', line 55 def started(result) @suite_result = result @last_assertion_count = 0 @current_suite = nil @unknown_count = 0 @result_assertion_count = 0 end |
#test_finished(name) ⇒ Object
72 73 74 |
# File 'lib/ci/reporter/test_unit.rb', line 72 def test_finished(name) finish_test end |
#test_started(name) ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/ci/reporter/test_unit.rb', line 63 def test_started(name) test_name, suite_name = extract_names(name) unless @current_suite && @current_suite.name == suite_name finish_suite start_suite(suite_name) end start_test(test_name) end |