Class: Minitest::StatisticsReporter
- Inherits:
-
Reporter
- Object
- AbstractReporter
- Reporter
- Minitest::StatisticsReporter
- Defined in:
- lib/minitest.rb
Overview
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.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#assertions ⇒ Object
:stopdoc:.
-
#count ⇒ Object
Returns the value of attribute count.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#failures ⇒ Object
Returns the value of attribute failures.
-
#results ⇒ Object
Returns the value of attribute results.
-
#skips ⇒ Object
Returns the value of attribute skips.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
-
#total_time ⇒ Object
Returns the value of attribute total_time.
Attributes inherited from Reporter
Instance Method Summary collapse
-
#initialize(io = $stdout, options = {}) ⇒ StatisticsReporter
constructor
:startdoc:.
-
#passed? ⇒ Boolean
:nodoc:.
-
#record(result) ⇒ Object
:nodoc:.
-
#report ⇒ Object
:nodoc:.
-
#start ⇒ Object
:nodoc:.
Methods inherited from AbstractReporter
Constructor Details
#initialize(io = $stdout, options = {}) ⇒ StatisticsReporter
:startdoc:
644 645 646 647 648 649 650 651 652 653 654 655 |
# File 'lib/minitest.rb', line 644 def initialize io = $stdout, = {} # :nodoc: super self.assertions = 0 self.count = 0 self.results = [] self.start_time = nil self.total_time = nil self.failures = nil self.errors = nil self.skips = nil end |
Instance Attribute Details
#assertions ⇒ Object
:stopdoc:
634 635 636 |
# File 'lib/minitest.rb', line 634 def assertions @assertions end |
#count ⇒ Object
Returns the value of attribute count.
635 636 637 |
# File 'lib/minitest.rb', line 635 def count @count end |
#errors ⇒ Object
Returns the value of attribute errors.
640 641 642 |
# File 'lib/minitest.rb', line 640 def errors @errors end |
#failures ⇒ Object
Returns the value of attribute failures.
639 640 641 |
# File 'lib/minitest.rb', line 639 def failures @failures end |
#results ⇒ Object
Returns the value of attribute results.
636 637 638 |
# File 'lib/minitest.rb', line 636 def results @results end |
#skips ⇒ Object
Returns the value of attribute skips.
641 642 643 |
# File 'lib/minitest.rb', line 641 def skips @skips end |
#start_time ⇒ Object
Returns the value of attribute start_time.
637 638 639 |
# File 'lib/minitest.rb', line 637 def start_time @start_time end |
#total_time ⇒ Object
Returns the value of attribute total_time.
638 639 640 |
# File 'lib/minitest.rb', line 638 def total_time @total_time end |
Instance Method Details
#passed? ⇒ Boolean
:nodoc:
657 658 659 |
# File 'lib/minitest.rb', line 657 def passed? # :nodoc: results.all?(&:skipped?) end |
#record(result) ⇒ Object
:nodoc:
665 666 667 668 669 670 |
# File 'lib/minitest.rb', line 665 def record result # :nodoc: self.count += 1 self.assertions += result.assertions results << result if not result.passed? or result.skipped? end |
#report ⇒ Object
:nodoc:
672 673 674 675 676 677 678 679 680 |
# File 'lib/minitest.rb', line 672 def report # :nodoc: 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 |
#start ⇒ Object
:nodoc:
661 662 663 |
# File 'lib/minitest.rb', line 661 def start # :nodoc: self.start_time = Minitest.clock_time end |