Class: Test::Unit::UI::HTML::TestRunner
- Inherits:
-
UI::TestRunner
- Object
- UI::TestRunner
- Test::Unit::UI::HTML::TestRunner
- Includes:
- ERB::Util
- Defined in:
- lib/test/unit/ui/html/testrunner.rb
Overview
Runs a Test::Unit::TestSuite and outputs HTML.
Instance Method Summary collapse
-
#initialize(suite, options = {}) ⇒ TestRunner
constructor
Creates a new TestRunner for running the passed suite.
Constructor Details
#initialize(suite, options = {}) ⇒ TestRunner
Creates a new TestRunner for running the passed suite. :output option specifies where runner output should go to; defaults to STDOUT.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/test/unit/ui/html/testrunner.rb', line 27 def initialize(suite, ={}) super Dir.mkdir [:report_dir] unless Dir.exist? [:report_dir] unless [:report_dir] =~ /[\\\/]$/ [:report_dir] = [:report_dir] + '/' end dir = [:report_dir] || '' of = "#{Time.now.to_i.to_s}_#{@options[:output_file]}" if ([:output_file] && ![:same_report]) of ||= [:output_file] @output = File.new(dir+of, "w") if of @output ||= STDOUT @already_outputted = false @indent = 0 @top_level = true @current_test = nil @current_test_suite = nil @already_outputted = false @summary = [] @cur_suite = nil @cur_suite_cases = [] @cur_case = nil @cur_case_tests = [] @cur_test = nil end |