Class: Test::Unit::UI::HTML::TestRunner

Inherits:
UI::TestRunner
  • Object
show all
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

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, options={})
  super
  Dir.mkdir @options[:report_dir] unless Dir.exist? @options[:report_dir]
  unless @options[:report_dir] =~ /[\\\/]$/
    @options[:report_dir] = @options[:report_dir]  + '/'
  end
  dir = @options[:report_dir] || ''
  of =  "#{Time.now.to_i.to_s}_#{@options[:output_file]}" if (@options[:output_file] && !@options[:same_report])
  of ||= @options[: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