Class: Minitest::StatisticsReporter (Ruby 2.7.5)
Description: Class : Minitest::StatisticsReporter - Ruby 2.7.5

### Home Classes Methods

### In Files

- minitest-5.13.0/lib/minitest.rb

### Parent

Minitest::Reporter

### Methods

- #report

### Files

- History.rdoc
- README.rdoc

### Class/Module Index

Quicksearch

- Kernel
- Minitest::AbstractReporter
- Minitest::Assertion
- Minitest::Assertions
- Minitest::BacktraceFilter
- Minitest::BenchSpec
- Minitest::Benchmark
- Minitest::CompositeReporter
- Minitest::Expectations
- Minitest::Guard
- Minitest::Mock
- Minitest::Parallel
- Minitest::Parallel::Executor
- Minitest::PrideIO
- Minitest::PrideLOL
- Minitest::ProgressReporter
- Minitest::Reportable
- Minitest::Result
- Minitest::Skip
- Minitest::Spec
- Minitest::Spec::DSL
- Minitest::Spec::DSL::InstanceMethods
- Minitest::StatisticsReporter
- Minitest::SummaryReporter
- Minitest::Test
- Minitest::Test::LifecycleHooks
- Minitest::UnexpectedError
- Object
- SubThingySpec
- ThingySpec

No matching classes.

# 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.13.0/lib/minitest.rb, line 728
    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