Parent

Included Modules

Class Index [+]

Quicksearch

Test::Unit::UI::TestRunnerMediator

Provides an interface to write any given UI against, hopefully making it easy to write new UIs.

Constants

RESET
(Not documented)
STARTED
(Not documented)
FINISHED
(Not documented)

Public Class Methods

new(suite) click to toggle source

Creates a new TestRunnerMediator initialized to run the passed suite.

# File lib/test/unit/ui/testrunnermediator.rb, line 26
        def initialize(suite)
          @suite = suite
        end

Public Instance Methods

run_suite() click to toggle source

Runs the suite the TestRunnerMediator was created with.

# File lib/test/unit/ui/testrunnermediator.rb, line 32
        def run_suite
          Unit.run = true

          result = create_result
          result_listener = result.add_listener(TestResult::CHANGED) do |*args|
            notify_listeners(TestResult::CHANGED, *args)
          end
          fault_listener = result.add_listener(TestResult::FAULT) do |*args|
            notify_listeners(TestResult::FAULT, *args)
          end

          start_time = Time.now
          begin
            notify_listeners(RESET, @suite.size)
            notify_listeners(STARTED, result)

            @suite.run(result) do |channel, value|
              notify_listeners(channel, value)
            end
          ensure
            elapsed_time = Time.now - start_time
            result.remove_listener(TestResult::FAULT, fault_listener)
            result.remove_listener(TestResult::CHANGED, result_listener)
            notify_listeners(FINISHED, elapsed_time)
          end

          result
        end

Private Instance Methods

create_result() click to toggle source

A factory method to create the result the mediator should run with. Can be overridden by subclasses if one wants to use a different result.

# File lib/test/unit/ui/testrunnermediator.rb, line 65
        def create_result
          TestResult.new
        end
measure_time() click to toggle source

(Not documented)

# File lib/test/unit/ui/testrunnermediator.rb, line 69
        def measure_time
          begin_time = Time.now
          yield
          Time.now - begin_time
        end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.