123456789_123456789_123456789_123456789_123456789_

Class: Minitest::SummaryReporter

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Minitest::StatisticsReporter
Defined in: lib/minitest.rb

Overview

A reporter that prints the header, summary, and failure details at the end of the run.

This is added to the top-level CompositeReporter at the start of the run. If you want to change the output of minitest via a plugin, pull this out of the composite and replace it with your own.

Class Method Summary

StatisticsReporter - Inherited

Reporter - Inherited

AbstractReporter - Inherited

Instance Attribute Summary

StatisticsReporter - Inherited

#assertions

Total number of assertions.

#count

Total number of test cases.

#errors

Total number of tests that erred.

#failures

Total number of tests that failed.

#results

An Array of test cases that failed or were skipped.

#skips

Total number of tests that where skipped.

#start_time

Time the test run started.

#total_time

Test run time.

#passed?

Reporter - Inherited

#io

The IO used to report.

#options

Command-line options for this run.

AbstractReporter - Inherited

#passed?

Did this run pass?

Instance Method Summary

StatisticsReporter - Inherited

#report

Report on the tracked statistics.

#record, #start

AbstractReporter - Inherited

#prerecord

About to start running a test.

#record

Output and record the result of the test.

#report

Outputs the summary of the run.

#start

Starts reporting on the run.

#synchronize

Constructor Details

This class inherits a constructor from Minitest::StatisticsReporter

Instance Attribute Details

#old_sync (rw)

[ GitHub ]

  
# File 'lib/minitest.rb', line 844

attr_accessor :old_sync

#sync (rw)

[ GitHub ]

  
# File 'lib/minitest.rb', line 843

attr_accessor :sync

Instance Method Details

#aggregated_results(io)

[ GitHub ]

  
# File 'lib/minitest.rb', line 876

def aggregated_results io # :nodoc:
  filtered_results = results.dup
  filtered_results.reject!(&:skipped?) unless
    options[:verbose] or options[:show_skips]

  skip = options[:skip] || []

  filtered_results.each_with_index { |result, i|
    next if skip.include? result.result_code

    io.puts "\n%3d) %s" % [i+1, result]
  }
  io.puts
  io
end

#report

[ GitHub ]

  
# File 'lib/minitest.rb', line 859

def report # :nodoc:
  super

  io.sync = self.old_sync

  io.puts unless options[:verbose] # finish the dots
  io.puts
  io.puts statistics
  aggregated_results io
  io.puts summary
end

#start

[ GitHub ]

  
# File 'lib/minitest.rb', line 847

def start # :nodoc:
  super

  io.puts "Run options: #{options[:args]}"
  io.puts
  io.puts "# Running:"
  io.puts

  self.sync = io.respond_to? :"sync="
  self.old_sync, io.sync = io.sync, true if self.sync
end

#statistics

[ GitHub ]

  
# File 'lib/minitest.rb', line 871

def statistics # :nodoc:
  "Finished in %.6fs, %.4f runs/s, %.4f assertions/s." %
    [total_time, count / total_time, assertions / total_time]
end

#summary

[ GitHub ]

  
# File 'lib/minitest.rb', line 896

def summary # :nodoc:
  extra = ""

  extra = "\n\nYou have skipped tests. Run with --verbose for details." if
    results.any?(&:skipped?) unless
    options[:verbose] or options[:show_skips] or ENV["MT_NO_SKIP_MSG"]

  "%d runs, %d assertions, %d failures, %d errors, %d skips%s" %
    [count, assertions, failures, errors, skips, extra]
end

#to_s

[ GitHub ]

  
# File 'lib/minitest.rb', line 892

def to_s # :nodoc:
  aggregated_results(StringIO.new(''.b)).string
end