Class: MiniTest::ReporterRunner
- Inherits:
-
Unit
- Object
- Unit
- MiniTest::ReporterRunner
- Extended by:
- Forwardable
- Defined in:
- lib/minitest/reporter_runner.rb
Overview
Runner for MiniTest that supports reporters.
Based upon Ryan Davis of Seattle.rb's MiniTest (MIT License).
Instance Attribute Summary collapse
-
#reporters
Returns the value of attribute reporters.
-
#suite_start_time
readonly
Returns the value of attribute suite_start_time.
-
#suites_start_time
readonly
Returns the value of attribute suites_start_time.
-
#test_results
readonly
Returns the value of attribute test_results.
-
#test_start_time
readonly
Returns the value of attribute test_start_time.
Instance Method Summary collapse
- #_run_suite(suite, type)
- #_run_suites(suites, type)
- #after_test(suite, test)
- #before_test(suite, test)
-
#initialize ⇒ ReporterRunner
constructor
A new instance of ReporterRunner.
- #print(*args)
-
#puts(*args)
Stub out the three IO methods used by the built-in reporter.
- #record(suite, test, assertions, time, exception)
- #status(io = output)
Constructor Details
#initialize ⇒ ReporterRunner
Returns a new instance of ReporterRunner.
20 21 22 23 24 25 |
# File 'lib/minitest/reporter_runner.rb', line 20 def initialize super self.reporters = [] @test_results = {} @test_recorder = TestRecorder.new end |
Instance Attribute Details
#reporters
Returns the value of attribute reporters.
12 13 14 |
# File 'lib/minitest/reporter_runner.rb', line 12 def reporters @reporters end |
#suite_start_time (readonly)
Returns the value of attribute suite_start_time.
15 16 17 |
# File 'lib/minitest/reporter_runner.rb', line 15 def suite_start_time @suite_start_time end |
#suites_start_time (readonly)
Returns the value of attribute suites_start_time.
14 15 16 |
# File 'lib/minitest/reporter_runner.rb', line 14 def suites_start_time @suites_start_time end |
#test_results (readonly)
Returns the value of attribute test_results.
13 14 15 |
# File 'lib/minitest/reporter_runner.rb', line 13 def test_results @test_results end |
#test_start_time (readonly)
Returns the value of attribute test_start_time.
16 17 18 |
# File 'lib/minitest/reporter_runner.rb', line 16 def test_start_time @test_start_time end |
Instance Method Details
#_run_suite(suite, type)
38 39 40 41 42 43 44 |
# File 'lib/minitest/reporter_runner.rb', line 38 def _run_suite(suite, type) @suite_start_time = Time.now trigger_callback(:before_suite, suite) super(suite, type) ensure trigger_callback(:after_suite, suite) end |
#_run_suites(suites, type)
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/minitest/reporter_runner.rb', line 27 def _run_suites(suites, type) output.puts "# Run options: #{@help}" @suites_start_time = Time.now count_tests!(suites, type) trigger_callback(:before_suites, suites, type) super(suites, type) ensure trigger_callback(:after_suites, suites, type) end |
#after_test(suite, test)
67 68 69 70 71 72 73 74 75 |
# File 'lib/minitest/reporter_runner.rb', line 67 def after_test(suite, test) runners = @test_recorder[suite, test.to_sym] runners.each do |runner| trigger_callback(runner.result, suite, test.to_sym, runner) end trigger_callback(:after_test, suite, test.to_sym) end |
#before_test(suite, test)
46 47 48 49 |
# File 'lib/minitest/reporter_runner.rb', line 46 def before_test(suite, test) @test_start_time = Time.now trigger_callback(:before_test, suite, test) end |
#print(*args)
79 |
# File 'lib/minitest/reporter_runner.rb', line 79 def print(*args); end |
#puts(*args)
Stub out the three IO methods used by the built-in reporter.
78 |
# File 'lib/minitest/reporter_runner.rb', line 78 def puts(*args); end |
#record(suite, test, assertions, time, exception)
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/minitest/reporter_runner.rb', line 51 def record(suite, test, assertions, time, exception) runner = TestRunner.new(suite, test.to_sym, assertions, time, exception) @test_results[suite] ||= {} @test_results[suite][test.to_sym] = runner @test_recorder.record(runner) # MiniTest < 4.1.0 sends #record after all teardown hooks, so explicitly # call #after_test here after recording. after_test(suite, test) if Unit::VERSION <= "4.1.0" end |
#status(io = output)
80 |
# File 'lib/minitest/reporter_runner.rb', line 80 def status(io = output); end |