In Files

  • minitest-5.15.0/lib/minitest.rb

Parent

Methods

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

assertions[RW]

Total number of assertions.

count[RW]

Total number of test cases.

errors[RW]

Total number of tests that erred.

failures[RW]

Total number of tests that failed.

results[RW]

An Array of test cases that failed or were skipped.

skips[RW]

Total number of tests that where skipped.

start_time[RW]

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

total_time[RW]

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

Public Instance Methods

report() click to toggle source

Report on the tracked statistics.

 
               # File minitest-5.15.0/lib/minitest.rb, line 739
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.skips      = aggregate[Skip].size
end