Class: Turn::OutlineReporter

### Home Classes Methods

### In Files

- lib/turn/reporters/outline_reporter.rb

### Parent

Turn::Reporter

### Methods

- #error
- #fail
- #finish_suite
- #finish_test
- #pass
- #show_captured_output
- #show_captured_stdout
- #skip
- #start_case
- #start_suite
- #start_test

### Files

- History.txt
- LICENSE.txt
- Release.txt
- Version.txt

### Class/Module Index

Quicksearch

- Turn
- Turn::Colorize
- Turn::Command
- Turn::Configuration
- Turn::Controller
- Turn::CrossRunner
- Turn::CueReporter
- Turn::DotReporter
- Turn::IsoRunner
- Turn::MarshalReporter
- Turn::MiniRunner
- Turn::OutlineReporter
- Turn::PrettyReporter
- Turn::ProgressReporter
- Turn::Reporter
- Turn::SoloRunner
- Turn::TestCase
- Turn::TestMethod
- Turn::TestRunner
- Turn::TestSuite
- Turn::ToptenDecorator
- Test
- Test::Unit
- Test::Unit::Failure
- Object
- String

No matching classes.

# Turn::OutlineReporter

Outline Reporter is Turn's Original.

### Constants

TAB_SIZE

### Public Instance Methods

error(exception) click to toggle source

    # File lib/turn/reporters/outline_reporter.rb, line 94
    def error(exception)
      io.puts " %s %s" % [ticktock, ERROR]

      message = []
      message << Colorize.bold(exception.message)
      message << "Exception `#{exception.class}' at:"
      message << clean_backtrace(exception.backtrace).join("\n")
      message = message.join("\n")

      io.puts(message.tabto(TAB_SIZE))

      #io.puts "STDERR:".tabto(TAB_SIZE)
      show_captured_output
    end

fail(assertion) click to toggle source

    # File lib/turn/reporters/outline_reporter.rb, line 73
    def fail(assertion)
      io.puts " %s %s" % [ticktock, FAIL]

      message = []
      message << Colorize.bold(assertion.message.to_s)
      message << "Assertion at:"
      message << clean_backtrace(assertion.backtrace).join("\n")
      message = message.join("\n")

      io.puts(message.tabto(TAB_SIZE))

      #unless backtrace.empty?
      #  io.puts "Assertion at".tabto(TAB_SIZE)
      #  io.puts backtrace.map{|l| l.tabto(TAB_SIZE)}.join("\n")
      #end

      #io.puts "STDERR:".tabto(TAB_SIZE)
      show_captured_output
    end

finish_suite(suite) click to toggle source

TODO: pending (skip) counts

    # File lib/turn/reporters/outline_reporter.rb, line 159
    def finish_suite(suite)
      total      = suite.count_tests
      passes     = suite.count_passes
      assertions = suite.count_assertions
      failures   = suite.count_failures
      errors     = suite.count_errors
      skips      = suite.count_skips

      bar = '=' * 78
      bar = passes == total ? Colorize.green(bar) : Colorize.red(bar)

      # @FIXME: Should we add suite.runtime, instead if this lame time calculations?
      tally = [total, assertions, (Time.new - @time)]

      io.puts bar
      io.puts "  pass: %d,  fail: %d,  error: %d, skip: %d" % [passes, failures, errors, skips]
      io.puts "  total: %d tests with %d assertions in %f seconds" % tally
      io.puts bar
    end

finish_test(test) click to toggle source

    # File lib/turn/reporters/outline_reporter.rb, line 121
    def finish_test(test)
      $stdout = STDOUT
      $stderr = STDERR
    end

pass(message=nil) click to toggle source

    # File lib/turn/reporters/outline_reporter.rb, line 62
    def pass(message=nil)
      io.puts " %s %s" % [ticktock, PASS]

      if message
        message = Colorize.magenta(message)
        message = message.to_s.tabto(TAB_SIZE)
        io.puts(message)
      end
    end

show_captured_output() click to toggle source

    # File lib/turn/reporters/outline_reporter.rb, line 127
    def show_captured_output
      show_captured_stdout
      #show_captured_stderr
    end

show_captured_stdout() click to toggle source

    # File lib/turn/reporters/outline_reporter.rb, line 133
    def show_captured_stdout
      @stdout.rewind
      return if @stdout.eof?
      STDOUT.puts(\nSTDOUT:#{@stdout.read}.tabto(8))
    end

skip(exception) click to toggle source

    # File lib/turn/reporters/outline_reporter.rb, line 110
    def skip(exception)
      io.puts " %s %s" % [ticktock, SKIP]

      message = exception.message

      io.puts(message.tabto(8))

      show_captured_output
    end

start_case(kase) click to toggle source

    # File lib/turn/reporters/outline_reporter.rb, line 38
    def start_case(kase)
      io.puts(Colorize.bold("#{kase.name}")) if kase.size > 0
    end

start_suite(suite) click to toggle source

    # File lib/turn/reporters/outline_reporter.rb, line 21
    def start_suite(suite)
      @suite  = suite
      @time   = Time.now
      # @FIXME (y8): Why we need to capture stdout and stderr?
      @stdout = StringIO.new
      @stderr = StringIO.new
      #files  = suite.collect{ |s| s.file }.join(' ')
      puts '=' * 78
      if suite.seed
        io.puts "SUITE #{suite.name} (SEED #{suite.seed})"
      else
        io.puts "SUITE #{suite.name}"
      end
      puts '=' * 78
    end

start_test(test) click to toggle source

    # File lib/turn/reporters/outline_reporter.rb, line 43
    def start_test(test)
      #if @file != test.file
      #  @file = test.file
      #  io.puts(test.file)
      #end

      # @FIXME: Should we move naturalized_name to test itself?
      name = naturalized_name(test)

      io.print "     %-57s" % name

      @stdout.rewind
      @stderr.rewind

      $stdout = @stdout
      $stderr = @stderr unless $DEBUG
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.