Provide information and optionally, a payload, to the Reporter
via an
InfoProvided
event.
Provide information and optionally, a payload, to the Reporter
via an
InfoProvided
event.
a string that will be forwarded to the wrapped Reporter
via an InfoProvided
event.
an optional object which will be forwarded to the wrapped Reporter
as a payload via an InfoProvided
event.
if message
or payload
reference is null
Trait to which custom information about a running suite of tests can be reported.
An
Informer
is essentially used to wrap aReporter
and provide easy ways to send custom information to thatReporter
via anInfoProvided
event.Informer
contains anapply
method that takes a string and an optional payload object of typeAny
. TheInformer
will forward the passedmessage
string to theReporter
as themessage
parameter, and the optional payload object as thepayload
parameter, of anInfoProvided
event.Here's an example of using an
Informer
:If you run this
Suite
from the interpreter, you will see the message included in the printed report:scala> (new ExampleSuite).execute() ExampleSuite: - testAddition(Reporter) + Addition seems to work
Traits
FunSuite
,FunSpec
,FlatSpec
,WordSpec
,FeatureSpec
, and their sister traits inorg.scalatest.fixture
package declare an implicitinfo
method that returns anInformer
. This implicitinfo
is used, for example, to enable the syntax offered by theGivenWhenThen
trait, which contains methods that take an implicitInformer
. Here's an example of aFeatureSpec
that mixes inGivenWhenThen
:Were you to run this
FeatureSpec
in the interpreter, you would see the following messages included in the printed report:scala> (new ArithmeticFeatureSpec).run() Feature: Integer arithmetic Scenario: addition Given two integers When they are added Then the result is the sum of the two numbers Scenario: subtraction Given two integers When one is subtracted from the other Then the result is the difference of the two numbers