Provides an interface to write any given UI against, hopefully making it easy to write new UIs.
Creates a new TestRunnerMediator initialized to run the passed suite.
# File test/unit/ui/testrunnermediator.rb, line 26
def initialize(suite)
@suite = suite
end
Runs the suite the TestRunnerMediator was created with.
# File test/unit/ui/testrunnermediator.rb, line 32
def run_suite
Unit.run = true
begin_time = Time.now
notify_listeners(RESET, @suite.size)
result = create_result
notify_listeners(STARTED, result)
result_listener = result.add_listener(TestResult::CHANGED) do |updated_result|
notify_listeners(TestResult::CHANGED, updated_result)
end
fault_listener = result.add_listener(TestResult::FAULT) do |fault|
notify_listeners(TestResult::FAULT, fault)
end
@suite.run(result) do |channel, value|
notify_listeners(channel, value)
end
result.remove_listener(TestResult::FAULT, fault_listener)
result.remove_listener(TestResult::CHANGED, result_listener)
end_time = Time.now
elapsed_time = end_time - begin_time
notify_listeners(FINISHED, elapsed_time) #"Finished in #{elapsed_time} seconds.")
return result
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please see Improve the docs, or visit Documenting-ruby.org.