class Minitest::StatisticsReporter

A reporter that gathers statistics about a test run. Does not do any IO because meant to be used as a parent class for a reporter that does.

If you want to create an entirely different type of output (eg, CI, HTML, etc), this is the place to start.

Example:

class JenkinsCIReporter < StatisticsReporter
  def report
    super  # Needed to calculate some statistics

    print "<testsuite "
    print "tests='#{count}' "
    print "failures='#{failures}' "
    # Remaining XML...
  end
end

Attributes

Total number of assertions.

Total number of test cases.

Total number of tests that erred.

Total number of tests that failed.

An Array of test cases that failed or were skipped.

Total number of tests that where skipped.

Time the test run started. If available, the monotonic clock is used and this is a Float, otherwise it’s an instance of Time.

Test run time. If available, the monotonic clock is used and this is a Float, otherwise it’s an instance of Time.

Total number of tests that warned.

Public Instance Methods

Report on the tracked statistics.

# File lib/minitest.rb, line 876
def report
  aggregate = results.group_by { |r| r.failure.class }
  aggregate.default = [] # dumb. group_by should provide this

  self.total_time = Minitest.clock_time - start_time
  self.failures   = aggregate[Assertion].size
  self.errors     = aggregate[UnexpectedError].size
  self.warnings   = aggregate[UnexpectedWarning].size
  self.skips      = aggregate[Skip].size
end