Abstract Value Members
-
def
apply
(message: String): Unit
Concrete Value Members
-
def
!=
(arg0: AnyRef): Boolean
-
def
!=
(arg0: Any): Boolean
-
def
##
(): Int
-
def
==
(arg0: AnyRef): Boolean
-
def
==
(arg0: Any): Boolean
-
def
andThen
[A]
(g: (Unit) ⇒ A): (String) ⇒ A
-
def
asInstanceOf
[T0]
: T0
-
def
clone
(): AnyRef
-
def
compose
[A]
(g: (A) ⇒ String): (A) ⇒ Unit
-
def
eq
(arg0: AnyRef): Boolean
-
def
equals
(arg0: Any): Boolean
-
def
finalize
(): Unit
-
def
getClass
(): java.lang.Class[_]
-
def
hashCode
(): Int
-
def
isInstanceOf
[T0]
: Boolean
-
def
ne
(arg0: AnyRef): Boolean
-
def
notify
(): Unit
-
def
notifyAll
(): Unit
-
def
synchronized
[T0]
(arg0: ⇒ T0): T0
-
def
toString
(): String
-
def
wait
(): Unit
-
def
wait
(arg0: Long, arg1: Int): Unit
-
def
wait
(arg0: Long): Unit
Inherited from (String) ⇒ Unit
Inherited from AnyRef
Inherited from Any
Trait to which custom information about a running suite of tests can be reported.
An
Informeris essentially used to wrap aReporterand provide easy ways to send custom information to thatReportervia anInfoProvidedevent.Informercontains anapplymethod that takes an object. TheInformerwill invoketoStringon the passed object and forward the resulting string to theReporteras themessageparameter of anInfoProvidedevent.Here's an example of using an
Informerin aSuitesubclass:If you run this
Suitefrom the interpreter, you will see the message included in the printed report:scala> (new MySuite).execute() Test Starting - MySuite.testAddition(Reporter) Info Provided - MySuite.testAddition(Reporter): Addition seems to work Test Succeeded - MySuite.testAddition(Reporter)Traits
FunSuite,FunSpec,FlatSpec,WordSpec,FeatureSpec, and their sister traits inorg.scalatest.fixturepackage declare an implicitinfomethod that returns anInformer. This implicitinfois used, for example, to enable the syntax offered by theGivenWhenThentrait, which contains methods that take an implicitInformer. Here's an example of aFeatureSpecthat mixes inGivenWhenThen:Were you to run this
FeatureSpecin 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