abstract class Spectator::Formatting::Formatter
Overview
Base class and interface used to notify systems of events. This is typically used for producing output from test results, but can also be used to send data to external systems.
All event methods are implemented as no-ops. To respond to an event, override its method. Every method receives a notification object containing information about the event.
Methods are called in this order:
#start
#example_started
#example_finished
#example_passed
#example_pending
#example_failed
#stop
#start_dump
#dump_pending
#dump_failures
#dump_profile
#dump_summary
#close
Only one of the #example_passed
, #example_pending
, or #example_failed
methods
will be called after #example_finished
, depending on the outcome of the test.
The "dump" methods are called after all tests that will run have run. They are provided summarized information.
Direct Known Subclasses
- Spectator::Formatting::BroadcastFormatter
- Spectator::Formatting::DocumentFormatter
- Spectator::Formatting::HTMLFormatter
- Spectator::Formatting::JSONFormatter
- Spectator::Formatting::JUnitFormatter
- Spectator::Formatting::ProgressFormatter
- Spectator::Formatting::TAPFormatter
Defined in:
spectator/formatting/formatter.crInstance Method Summary
-
#close
Invoked at the end of the program.
-
#dump_failures(_notification)
Invoked after testing completes with a list of failed examples.
-
#dump_pending(_notification)
Invoked after testing completes with a list of pending examples.
-
#dump_profile(_notification)
Invoked after testing completes with profiling information.
-
#dump_summary(_notification)
Invoked after testing completes with summarized information from the test suite.
-
#example_error(_notification)
Invoked after an example fails from an unexpected error.
-
#example_failed(_notification)
Invoked after an example fails.
-
#example_finished(_notification)
Invoked just after an example completes.
-
#example_passed(_notification)
Invoked after an example completes successfully.
-
#example_pending(_notification)
Invoked after an example is skipped or marked as pending.
-
#example_started(_notification)
Invoked just before an example runs.
-
#message(_notification)
Called whenever the example or framework produces a message.
-
#start(_notification)
This method is the first method to be invoked and will be called only once.
-
#start_dump
Invoked after all examples finished.
-
#stop
Invoked after all tests that will run have completed.
Instance methods inherited from class Object
should(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall Ushould(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should, should_eventually(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_eventually, should_never(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_never, should_not(matcher : Spectator::Matchers::TypeMatcher(U), message = nil, *, _file = __FILE__, _line = __LINE__) forall U
should_not(matcher : Spectator::Matchers::NilMatcher, message = nil, *, _file = __FILE__, _line = __LINE__)
should_not(matcher, message = nil, *, _file = __FILE__, _line = __LINE__) should_not
Instance Method Detail
Invoked at the end of the program. Allows the formatter to perform any cleanup and teardown.
Invoked after testing completes with a list of failed examples.
This method will be called with an empty list if there were no failures.
Called after #dump_pending
and before #dump_summary
.
The notification will be an ExampleSummaryNotification
type of object.
Invoked after testing completes with a list of pending examples.
This method will be called with an empty list if there were no pending (skipped) examples.
Called after #start_dump
and before #dump_failures
.
The notification will be an ExampleSummaryNotification
type of object.
Invoked after testing completes with profiling information.
This method is only called if profiling is enabled.
Called after #dump_failures
and before #dump_summary
.
Invoked after testing completes with summarized information from the test suite.
Called after #dump_profile
and before #close
.
The notification will be an SummaryNotification
type of object.
Invoked after an example fails from an unexpected error.
This is called right after #example_finished
.
The notification will be an ExampleNotification
type of object.
Invoked after an example fails.
This is called right after #example_finished
.
The notification will be an ExampleNotification
type of object.
NOTE Errors are normally considered failures,
however #example_error
is called instead if one occurs in an example.
Invoked just after an example completes.
This method is called once for every example.
One of #example_passed
, #example_pending
or #example_failed
will be called immediately after this method, depending on the example's result.
The notification will be an ExampleNotification
type of object.
Invoked after an example completes successfully.
This is called right after #example_finished
.
The notification will be an ExampleNotification
type of object.
Invoked after an example is skipped or marked as pending.
This is called right after #example_finished
.
The notification will be an ExampleNotification
type of object.
Invoked just before an example runs.
This method is called once for every example.
The notification will be an ExampleNotification
type of object.
Called whenever the example or framework produces a message.
This is typically used for logging.
The notification will be a MessageNotification
type of object.
This method is the first method to be invoked
and will be called only once.
It is called before any examples run.
The notification will be a StartNotification
type of object.
Invoked after all examples finished.
Indicates that summarized report data is about to be produced.
This method is called after #stop
and before #dump_pending
.
Invoked after all tests that will run have completed. When this method is called, it should be considered that the testing is done. Summary (dump) methods will be called after this.