package events
Classes for events sent to the org.scalatest.Reporter to report the results of running tests.
This package is released as part of the scalatest-core
module.
- Source
- package.scala
- Alphabetic
- By Inheritance
- events
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final case class AlertProvided(ordinal: Ordinal, message: String, nameInfo: Option[NameInfo], throwable: Option[Throwable] = None, formatter: Option[Formatter] = None, location: Option[Location] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with NotificationEvent with Product with Serializable
Event used to provide alert notifications.
Event used to provide alert notifications.
To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire anAlertProvided
event like this:report(AlertProvided(ordinal, message, Some(NameInfo(suiteName, suiteId, Some(thisSuite.getClass.getName), Some(testName)))))
AlertProvided
differs fromInfoProvided
in that unlikeInfoProvided
,AlertProvided
isn't aRecordableEvent
. If fired becase of analert
call from a test, for example, theAlertProvided
will immediately be sent to the reporters rather than being stored and sent in therecordedEvents
field of the test completion event. Thus,AlertProvided
enables "status notifications" to be provided while tests are happening. The difference betweenAlertProvided
andNoteProvided
, which is also a "status notification" fired immediately during tests, is thatAlertProvided
is intended for warnings, where asNoteProvided
is just for information. As an illustration,AlertProvided
messages are displayed in yellow,NoteProvided
in green, in the stdout, stderr, and file reporters.An
AlertProvided
event may be fired from anywhere. In this respectAlertProvided
is different from events for which it is defined whether they are fired in the context of a suite or test. If fired in the context of a test, theAlertProvided
event should include aNameInfo
in whichtestName
is defined. If fired in the context of a suite, but not a test, theAlertProvided
event should include aNameInfo
in whichtestName
is not defined. If fired within the context of neither a suite nor a test, thenameInfo
of theAlertProvided
event (anOption[NameInfo]
) should beNone
.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- message
a localized message suitable for presenting to the user
- nameInfo
an optional
NameInfo
that if defined, provides names for the suite and optionally the test in the context of which the information was provided- throwable
an optional
Throwable
- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- payload
an optional object that can be used to pass custom information to the reporter about the
AlertProvided
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class DiscoveryCompleted(ordinal: Ordinal, duration: Option[Long] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a runner has completed searching for suites.
Event that indicates a runner has completed searching for suites.
- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- duration
an optional amount of time, in milliseconds, that was required by the run that has completed
- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class DiscoveryStarting(ordinal: Ordinal, configMap: ConfigMap, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a runner is beginning search for suites to run.
Event that indicates a runner is beginning search for suites to run.
- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- configMap
a
ConfigMap
of key-value pairs that can be used by customReporter
s- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- sealed abstract class Event extends Ordered[Event] with Product with Serializable
A base class for the events that can be passed to the report function passed to the
execute
method of aSuite
. - sealed trait ExceptionalEvent extends Event
Marker trait for test failed and test canceled events.
- sealed abstract class Formatter extends Product with Serializable
Abstract class for the optional formatter objects that must be passed to the
Event
s reported during a ScalaTest run. - final case class IndentedText(formattedText: String, rawText: String, indentationLevel: Int) extends Formatter with Product with Serializable
A
Formatter
providing information that enables reporters to create more stylized output.A
Formatter
providing information that enables reporters to create more stylized output.An example is that specification-style suites, such as
FunSpec
, generate output that reads more like a specification, for instance:A Stack (when newly created) - should be empty - should complain when popped
This output might be generated by ScalaTest's standard out reporter. Each of these lines would be taken from the
IndentedText
'sformattedText
parameter. Were this same run to be reported in HTML or in a GUI, the output would be based on therawText
and theindentationLevel
. Here's what theIndentedText
values would be for each event:InfoProvided
reported with an:IndentedText( formattedText = "A Stack (when newly created)", rawText = "A Stack (when newly created)", indentationLevel = 0 )
TestSucceeded
reported with an:IndentedText( formattedText = "- should be empty", rawText = "should be empty", indentationLevel = 1 )
TestSucceeded
reported with an:IndentedText( formattedText = "- should complain when popped", rawText = "should complain when popped", indentationLevel = 1 )
One possible way this information could be presented in HTML, for example, is this:
A Stack (when newly created)
- should be empty
- should complain when popped
- formattedText
a localized string suitable for presenting to a user by printing it straight to an output stream
- rawText
a localized string suitable for presenting to the user after in some way being indented by the value specified as the
indentationLevel
parameter- indentationLevel
a zero or positive integer representing an indentation level for the indented text
- Exceptions thrown
IllegalArgumentException
if the specifiedindentationLevel
is less than zero
- final case class InfoProvided(ordinal: Ordinal, message: String, nameInfo: Option[NameInfo], throwable: Option[Throwable] = None, formatter: Option[Formatter] = None, location: Option[Location] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with RecordableEvent with Product with Serializable
Event used to provide information that is not appropriate to report via any other
Event
.Event used to provide information that is not appropriate to report via any other
Event
.To create instances of this class you may use the factory method provided in its companion object. For example, given a report function named
report
, you could fire aInfoProvided
event like this:report(InfoProvided(ordinal, message, Some(NameInfo(suiteName, suiteId, Some(thisSuite.getClass.getName), Some(testName)))))
An
InfoProvided
event may be fired from anywhere. In this respectInfoProvided
is different from events for which it is defined whether they are fired in the context of a suite or test. If fired in the context of a test, theInfoProvided
event should include aNameInfo
in whichtestName
is defined. If fired in the context of a suite, but not a test, theInfoProvided
event should include aNameInfo
in whichtestName
is not defined. If fired within the context of neither a suite nor a test, thenameInfo
of theInfoProvided
event (anOption[NameInfo]
) should beNone
.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- message
a localized message suitable for presenting to the user
- nameInfo
an optional
NameInfo
that if defined, provides names for the suite and optionally the test in the context of which the information was provided- throwable
an optional
Throwable
- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- payload
an optional object that can be used to pass custom information to the reporter about the
InfoProvided
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class LineInFile(lineNumber: Int, fileName: String, filePathname: Option[String]) extends Location with Product with Serializable
An arbitrary line number in a named source file.
An arbitrary line number in a named source file.
- lineNumber
the line number
- fileName
the source file's simple name
- filePathname
an optional fully qualified pathname of the source file
- sealed abstract class Location extends Product with Serializable
Location in source code indicating where in the source code an event originated.
- final case class MarkupProvided(ordinal: Ordinal, text: String, nameInfo: Option[NameInfo], formatter: Option[Formatter] = None, location: Option[Location] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with RecordableEvent with Product with Serializable
Event used to provide markup text for document-style reports.
Event used to provide markup text for document-style reports.
To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aMarkupProvided
event like this:report(MarkupProvided(ordinal, text, Some(NameInfo(suiteName, suiteId, Some(thisSuite.getClass.getName), Some(testName)))))
A
MarkupProvided
event may be fired from anywhere. In this respectMarkupProvided
is different from the other events, for which it is defined whether they are fired in the context of a suite or test. If fired in the context of a test, theMarkupProvided
event should include aNameInfo
in whichtestName
is defined. If fired in the context of a suite, but not a test, theMarkupProvided
event should include aNameInfo
in whichtestName
is not defined. If fired within the context of neither a suite nor a test, thenameInfo
of theMarkupProvided
event (anOption[NameInfo]
) should beNone
.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- text
a snippet of markup text (in Markdown format)
- nameInfo
an optional
NameInfo
that if defined, provides names for the suite and optionally the test in the context of which the information was provided- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- payload
an optional object that can be used to pass custom information to the reporter about the
MarkupProvided
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class NameInfo(suiteName: String, suiteId: String, suiteClassName: Option[String], testName: Option[String]) extends Product with Serializable
Class that holds information about names for the information events
InfoProvided
,MarkupProvided
,ScopeOpened
,ScopeClosed
,ScopePending
,AlertProvided
andNoteProvided
.Class that holds information about names for the information events
InfoProvided
,MarkupProvided
,ScopeOpened
,ScopeClosed
,ScopePending
,AlertProvided
andNoteProvided
.An information event may be fired from anywhere. In this respect these events are different from the other events, for which it is defined whether they are fired in the context of a suite or test. If fired in the context of a test, an information event event should include a
NameInfo
in whichtestName
is defined. If fired in the context of a suite, but not a test, theInfoProvided
event should include aNameInfo
in whichtestName
is not defined. If fired within the context of neither a suite nor a test, thenameInfo
of theInfoProvided
event (anOption[NameInfo]
) should beNone
.If either
suiteClassName
ortestName
is defined, thensuiteName
andsuiteId
must be defined. The suite class name parameter is optional even if a suite name is provided by passing aSome
assuiteName
, because suites in ScalaTest are an abstraction that need not necessarily correspond to one class. Nevertheless, in most cases each suite will correspond to a class, and when it does, the fully qualified name of that class should be reported by passing aSome
forsuiteClassName
. One use for this bit of information is JUnit integration, because the "name" provided to a JUnitorg.junit.runner.Description
appears to usually include a fully qualified class name by convention.- suiteName
an optional name of the suite about which an information event was fired
- suiteId
an optional string ID for the suite about which an information event was fired, intended to be unique across all suites in a run
- suiteClassName
an optional fully qualifed
Suite
class name about which the information was provided- testName
an optional test name information
- final case class NoteProvided(ordinal: Ordinal, message: String, nameInfo: Option[NameInfo], throwable: Option[Throwable] = None, formatter: Option[Formatter] = None, location: Option[Location] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with NotificationEvent with Product with Serializable
Event used to provide notifications.
Event used to provide notifications.
To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aNoteProvided
event like this:report(NoteProvided(ordinal, message, Some(NameInfo(suiteName, suiteId, Some(thisSuite.getClass.getName), Some(testName)))))
NoteProvided
differs fromInfoProvided
in that unlikeInfoProvided
,NoteProvided
isn't aRecordableEvent
. If fired because of anote
call from a test, for example, theNoteProvided
will immediately be sent to the reporters rather than being stored and sent in therecordedEvents
field of the test completion event. Thus,NoteProvided
enables "status notifications" to be provided while tests are happening. The difference betweenNoteProvided
andAlertProvided
, which is also a "status notification" fired immediately during tests, is thatAlertProvided
is intended for warnings, where asNoteProvided
is just for information. As an illustration,AlertProvided
messages are displayed in yellow,NoteProvided
in green, in the stdout, stderr, and file reporters.An
NoteProvided
event may be fired from anywhere. In this respectNoteProvided
is different from events for which it is defined whether they are fired in the context of a suite or test. If fired in the context of a test, theNoteProvided
event should include aNameInfo
in whichtestName
is defined. If fired in the context of a suite, but not a test, theNoteProvided
event should include aNameInfo
in whichtestName
is not defined. If fired within the context of neither a suite nor a test, thenameInfo
of theNoteProvided
event (anOption[NameInfo]
) should beNone
.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- message
a localized message suitable for presenting to the user
- nameInfo
an optional
NameInfo
that if defined, provides names for the suite and optionally the test in the context of which the information was provided- throwable
an optional
Throwable
- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- payload
an optional object that can be used to pass custom information to the reporter about the
NoteProvided
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- sealed trait NotificationEvent extends Event
Marker trait for the "notification" events
NoteProvided
andAlertProvided
. - final class Ordinal extends Ordered[Ordinal] with Serializable
Class used to specify a sequential order for events reported during a test run, so they can be arranged in that order in a report even if the events were fired in some other order during concurrent or distributed execution.
Class used to specify a sequential order for events reported during a test run, so they can be arranged in that order in a report even if the events were fired in some other order during concurrent or distributed execution.
An
Ordinal
is an immutable object holding a run stamp and a sequence of stamps. The run stamp is an integer that identifies a particular run. All events reported during the same run should share the same run stamp. By contrast, each event reported during a particular run should have a different stamp sequence. One use case for the run stamp is that the initial run from ScalaTest's GUI will have run stamp 0. Subsequent reruns will have run stamps 1, 2, 3, etc., so that reports in the GUI can simply be sorted in "ordinal" order. Another use case is a set of servers used to run multiple tests simultaneously in a distributed fashion. The run stamp can be used to identify the run to which an event belongs.The stamp sequence is designed to allow a sequential order of events to be specified during concurrent execution of ScalaTest suites. ScalaTest's model for concurrent execution is that the suites that make up a run may be executed concurrently, but the tests within a single suite will be executed sequentially. In addition to tests, suites may contain nested suites. The default implementation of
execute
in classSuite
will first invokerunNestedSuites
and thenrunTests
. If noDistributor
is passed toexecute
, therunNestedSuites
method will execute the nested suites sequentially via the same thread that invokedrunNestedSuites
. As a result, suites will by default executed in depth first order when executed sequentially. If aDistributor
is passed toexecute
, therunNestedSuites
method will simply put its nested suites into theDistributor
and return. Some other threads or processes must then execute those nested suites. Given the default implementations ofexecute
andrunNestedSuites
described here, theOrdinal
will allow the events from a concurrent run to be sorted in the same depth-first order that the events from a corresponding sequential run would arrive.Each event reported during a run should be given a unique
Ordinal
. AnOrdinal
is required by allEvent
subclasses, instances of which are used to send information to thereport
function passed to aSuite
'sexecute
method. The firstOrdinal
for a run can be produced by passing a run stamp toOrdinal
's lone public constructor:val firstOrdinal = new Ordinal(99)
The run stamp can be any integer. The
Ordinal
created in this way can be passed along with the first reported event of the run, such as aRunStarting
event. Thereafter, newOrdinal
s for the same run can be obtained by calling eithernext
ornextNewOldPair
on the previously obtainedOrdinal
. In other words, given anOrdinal
, you can obtain the nextOrdinal
by invoking one of these two "next" methods on theOrdinal
you have in hand. Before executing a newSuite
, thenextNewOldPair
method should be invoked. This will return two newOrdinal
s, one for the newSuite
about to be executed, and one for the currently executing entity (either aSuite
or some sort of test runner). At any other time, the nextOrdinal
can be obtained by simply invokingnext
on the currentOrdinal
.You can convert an
Ordinal
to aList
by invokingtoList
on it. The resultingList
will contain the run stamp as its first element, and the contents of its stamps sequence as the subsequent elements. The stamps sequence will initially be composed of a single element with the value 0. Thus,toList
invoked on thefirstOrdinal
shown above will result in:firstOrdinal.toList // results in: List(99, 0)
Each time
next
is invoked, the rightmost integer returned bytoList
will increment:val secondOrdinal = firstOrdinal.next secondOrdinal.toList // results in: List(99, 1) val thirdOrdinal = secondOrdinal.next thirdOrdinal.toList // result is : List(99, 2)
When
nextNewOldPair
is invoked the result will be a tuple whose first element is the firstOrdinal
for the newSuite
about to be executed (for example, a nestedSuite
of the currently executingSuite
). The second element is the nextOrdinal
for the currently executingSuite
or other entity:val (nextForNewSuite, nextForThisRunner) = thirdOrdinal.nextNewOldPair nextForNewSuite.toList // results in: (99, 2, 0) nextForThisRunner.toList // results in: (99, 3)
The
toList
method of theOrdinal
for the new suite starts with the same sequence of elements as theOrdinal
from which it was created, but has one more element, a 0, appended at the end. Subsequent invocations ofnext
on this series ofOrdinal
s will increment that last element:val newSuiteOrdinal2 = nextForNewSuite.next newSuiteOrdinal2.toList // results in: List(99, 2, 1) val newSuiteOrdinal3 = newSuiteOrdinal2.next newSuiteOrdinal3.toList // result is : List(99, 2, 2)
This behavior allows events fired by
Suite
running concurrently to be reordered in a pre-determined sequence after all the events have been reported. The ordering of twoOrdinal
s can be determined by first comparing the first element of theList
s obtained by invokingtoList
on bothOrdinal
s. These values represent therunStamp
. If one run stamp is a lower number than the other, thatOrdinal
comes first. For example, anOrdinal
with a run stamp of 98 is ordered before anOrdinal
with a run stamp of 99. If the run stamps are equal, the next number in the list is inspected. As with the run stamps, anOrdinal
with a lower number is ordered before anOrdinal
with a higher number. If two corresponding elements are equal, the next pair of elements will be inspected. This will continue no down the length of theList
s until a position is found where the element values are not equal, or the end of one or both of theList
s are reached. If the twoList
s are identical all the way to the end, and bothList
s have the same lengths, then theOrdinal
s are equal. (EqualOrdinal
s will not happen if correctly used by creating a newOrdinal
for each fired event and each newSuite
.). If the twoList
s are identical all the way to the end of one, but the otherList
is longer (has more elements), then the shorter list is ordered before the longer one.As an example, here are some
Ordinal
List
forms in order:List(99, 0) List(99, 1) List(99, 2) List(99, 2, 0) List(99, 2, 1) List(99, 2, 2) List(99, 2, 2, 0) List(99, 2, 2, 1) List(99, 2, 2, 2) List(99, 2, 3) List(99, 2, 4) List(99, 2, 4, 0) List(99, 2, 4, 1) List(99, 2, 4, 2) List(99, 3) List(99, 4) List(99, 4, 0) List(99, 4, 1) List(99, 5)
- sealed trait RecordableEvent extends Event
Marker trait for test completed event's recordedEvents.
- final case class RunAborted(ordinal: Ordinal, message: String, throwable: Option[Throwable], duration: Option[Long] = None, summary: Option[Summary] = None, formatter: Option[Formatter] = None, location: Option[Location] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a runner encountered an error while attempting to run a suite of tests.
Event that indicates a runner encountered an error while attempting to run a suite of tests.
For example, object
Runner
reportsRunAborted
if theexecute
method of any of the run's startingSuite
s completes abruptly with aThrowable
.ScalaTest's
Runner
fires aRunAborted
report with an emptysummary
, because the reporter is responsible for keeping track of the total number of tests reported as succeeded, failed, ignored, and pending. ScalaTest's internal reporter replaces theRunAborted
with a new one that is identical except that is has a definedsummary
.To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aRunAborted
event like this:report(RunAborted(ordinal, message, Some(exception)))
- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- message
a localized message suitable for presenting to the user
- throwable
an optional
Throwable
that, if aSome
, indicates why the run has aborted, or aThrowable
created to capture stack trace information about the problem.- duration
an optional amount of time, in milliseconds, that was required by the run that has aborted
- summary
an optional
Summary
of the number of tests that were reported as succeeded, failed, ignored, and pending- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- payload
an optional object that can be used to pass custom information to the reporter about the
RunAborted
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class RunCompleted(ordinal: Ordinal, duration: Option[Long] = None, summary: Option[Summary] = None, formatter: Option[Formatter] = None, location: Option[Location] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a runner has completed running a suite of tests.
Event that indicates a runner has completed running a suite of tests.
Suite
'sexecute
method takes aStopper
, whosestopRequested
method indicates a stop was requested. Iftrue
is returned bystopRequested
while a suite of tests is running, theexecute
method should promptly return even if that suite hasn't finished running all of its tests.If a stop was requested via the
Stopper
.Runner
will reportRunStopped
when theexecute
method of the run's startingSuite
returns. If a stop is not requested,Runner
will reportRunCompleted
when the lastexecute
method of the run's startingSuite
s returns.ScalaTest's
Runner
fires aRunCompleted
report with an emptysummary
, because the reporter is responsible for keeping track of the total number of tests reported as succeeded, failed, ignored, pending and canceled. ScalaTest's internal reporter replaces theRunCompleted
with a new one that is identical except that is has a definedsummary
.To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aRunCompleted
event like this:report(RunCompleted(ordinal))
- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- duration
an optional amount of time, in milliseconds, that was required by the run that has completed
- summary
an optional
Summary
of the number of tests that were reported as succeeded, failed, ignored, pending and canceled- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- payload
an optional object that can be used to pass custom information to the reporter about the
RunCompleted
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class RunStarting(ordinal: Ordinal, testCount: Int, configMap: ConfigMap, formatter: Option[Formatter] = None, location: Option[Location] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a runner is about run a suite of tests.
Event that indicates a runner is about run a suite of tests.
For example, object
Runner
reportsRunStarting
to indicate that the firstexecute
method of a run's initialSuite
is about to be invoked.To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aRunStarting
event like this:report(RunStarting(ordinal, testCount))
- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- testCount
the number of tests expected during this run
- configMap
a
ConfigMap
of key-value pairs that can be used by customReporter
s- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- payload
an optional object that can be used to pass custom information to the reporter about the
RunStarting
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- Exceptions thrown
IllegalArgumentException
iftestCount
is less than zero.
- final case class RunStopped(ordinal: Ordinal, duration: Option[Long] = None, summary: Option[Summary] = None, formatter: Option[Formatter] = None, location: Option[Location] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a runner has stopped running a suite of tests prior to completion, likely because of a stop request.
Event that indicates a runner has stopped running a suite of tests prior to completion, likely because of a stop request.
Suite
'sexecute
method takes aStopper
, whosestopRequested
method indicates a stop was requested. Iftrue
is returned bystopRequested
while a suite of tests is running, theexecute
method should promptly return even if that suite hasn't finished running all of its tests.If a stop was requested via the
Stopper
.Runner
will reportRunStopped
when theexecute
method of the run's startingSuite
returns. If a stop is not requested,Runner
will reportRunCompleted
when the lastexecute
method of the run's startingSuite
s returns.ScalaTest's
Runner
fires aRunStopped
report with an emptysummary
, because the reporter is responsible for keeping track of the total number of tests reported as succeeded, failed, ignored, pending and canceled. ScalaTest's internal reporter replaces theRunStopped
with a new one that is identical except that is has a definedsummary
.To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aRunStopped
event like this:report(RunStopped(ordinal))
- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- duration
an optional amount of time, in milliseconds, that was required by the run that has stopped
- summary
an optional summary of the number of tests that were reported as succeeded, failed, ignored pending and canceled
- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- payload
an optional object that can be used to pass custom information to the reporter about the
RunStopped
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class ScopeClosed(ordinal: Ordinal, message: String, nameInfo: NameInfo, formatter: Option[Formatter] = None, location: Option[Location] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a scope has been closed.
Event that indicates a scope has been closed.
To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aScopeClosed
event like this:report(ScopeClosed(ordinal, message, Some(NameInfo(suiteName, suiteId, Some(thisSuite.getClass.getName), Some(testName)))))
A
ScopeClosed
event may be fired from within suites or tests. If fired in the context of a test, theScopeClosed
event should include aNameInfo
in whichtestName
is defined. If fired in the context of a suite, but not a test, theScopeClosed
event should include aNameInfo
in whichtestName
is not defined.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- message
a localized message suitable for presenting to the user
- nameInfo
a
NameInfo
that provides names for the suite and optionally the test in the context of which the scope was closed- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- payload
an optional object that can be used to pass custom information to the reporter about the
ScopeClosed
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class ScopeOpened(ordinal: Ordinal, message: String, nameInfo: NameInfo, formatter: Option[Formatter] = None, location: Option[Location] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a new scope has been opened.
Event that indicates a new scope has been opened.
To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aScopeOpened
event like this:report(ScopeOpened(ordinal, message, Some(NameInfo(suiteName, suiteId, Some(thisSuite.getClass.getName), Some(testName)))))
A
ScopeOpened
event may be fired from within suites or tests. If fired in the context of a test, theScopeOpened
event should include aNameInfo
in whichtestName
is defined. If fired in the context of a suite, but not a test, theScopeOpened
event should include aNameInfo
in whichtestName
is not defined.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- message
a localized message suitable for presenting to the user
- nameInfo
a
NameInfo
that provides names for the suite and optionally the test in the context of which the scope was opened- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- payload
an optional object that can be used to pass custom information to the reporter about the
ScopeOpened
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class ScopePending(ordinal: Ordinal, message: String, nameInfo: NameInfo, formatter: Option[Formatter] = None, location: Option[Location] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a scope is pending.
Event that indicates a scope is pending.
To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aScopePending
event like this:report(ScopePending(ordinal, message, Some(NameInfo(suiteName, Some(thisSuite.getClass.getName), Some(testName)))))
A
ScopePending
event is fired from within suites, and not tests. TheScopePending
event should include aNameInfo
in whichtestName
is not defined.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- message
a localized message suitable for presenting to the user
- nameInfo
a
NameInfo
that provides names for the suite and optionally the test in the context of which the scope was closed- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- payload
an optional object that can be used to pass custom information to the reporter about the
ScopePending
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class SuiteAborted(ordinal: Ordinal, message: String, suiteName: String, suiteId: String, suiteClassName: Option[String], throwable: Option[Throwable] = None, duration: Option[Long] = None, formatter: Option[Formatter] = None, location: Option[Location] = None, rerunner: Option[String] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with ExceptionalEvent with Product with Serializable
Event that indicates the execution of a suite of tests has aborted, likely because of an error, prior to completion.
Event that indicates the execution of a suite of tests has aborted, likely because of an error, prior to completion.
For example, trait
Suite
and objectRunner
useSuiteAborted
to report that theexecute
method of aSuite
has completed abruptly with aRuntimeException
.To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aSuiteAborted
event like this:report(SuiteAborted(ordinal, userFriendlyName, message, suiteName, Some(thisSuite.getClass.getName)))
The suite class name parameter is optional, because suites in ScalaTest are an abstraction that need not necessarily correspond to one class. Nevertheless, in most cases each suite will correspond to a class, and when it does, the fully qualified name of that class should be reported by passing a
Some
forsuiteClassName
. One use for this bit of information is JUnit integration, because the "name" provided to a JUnitorg.junit.runner.Description
appears to usually include a fully qualified class name by convention.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run suite name, suitable for presenting to the user- message
a localized message suitable for presenting to the user
- suiteName
a localized name identifying the suite that has aborted, suitable for presenting to the user
- suiteId
a string ID for the suite that has aborted, intended to be unique across all suites in a run
- suiteClassName
an optional fully qualifed
Suite
class name containing the suite that has aborted- throwable
an optional
Throwable
that, if aSome
, indicates why the suite has aborted, or aThrowable
created to capture stack trace information about the problem.- duration
an optional amount of time, in milliseconds, that was required to execute the suite that has aborted
- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
an optional
Location
that provides information indicating where in the source code an event originated.- rerunner
an optional
String
giving the fully qualified name of the class that can be used to rerun the suite that has aborted. (IfNone
is passed, the suite cannot be rerun.)- payload
an optional object that can be used to pass custom information to the reporter about the
SuiteAborted
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class SuiteCompleted(ordinal: Ordinal, suiteName: String, suiteId: String, suiteClassName: Option[String], duration: Option[Long] = None, formatter: Option[Formatter] = None, location: Option[Location] = None, rerunner: Option[String] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a suite of tests has completed executing.
Event that indicates a suite of tests has completed executing.
For example, trait
Suite
and objectRunner
useSuiteCompleted
to report that theexecute
method of aSuite
has returned normally (without throwing aRuntimeException
).To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aSuiteCompleted
event like this:report(SuiteCompleted(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName)))
The suite class name parameter is optional, because suites in ScalaTest are an abstraction that need not necessarily correspond to one class. Nevertheless, in most cases each suite will correspond to a class, and when it does, the fully qualified name of that class should be reported by passing a
Some
forsuiteClassName
. One use for this bit of information is JUnit integration, because the "name" provided to a JUnitorg.junit.runner.Description
appears to usually include a fully qualified class name by convention.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- suiteName
a localized name identifying the suite that has completed, suitable for presenting to the user
- suiteId
a string ID for the suite that has completed, intended to be unique across all suites in a run
- suiteClassName
an optional fully qualifed
Suite
class name containing the suite that has completed- duration
an optional amount of time, in milliseconds, that was required to execute the suite that has completed
- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- rerunner
an optional
String
giving the fully qualified name of the class that can be used to rerun the suite that has completed. (IfNone
is passed, the suite cannot be rerun.)- payload
an optional object that can be used to pass custom information to the reporter about the
SuiteCompleted
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class SuiteStarting(ordinal: Ordinal, suiteName: String, suiteId: String, suiteClassName: Option[String], formatter: Option[Formatter] = None, location: Option[Location] = None, rerunner: Option[String] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a suite of tests is about to start executing.
Event that indicates a suite of tests is about to start executing.
For example, trait
Suite
and objectRunner
useSuiteStarting
to report that theexecute
method of aSuite
is about to be invoked.To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aSuiteStarting
event like this:report(SuiteStarting(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName)))
The suite class name parameter is optional, because suites in ScalaTest are an abstraction that need not necessarily correspond to one class. Nevertheless, in most cases each suite will correspond to a class, and when it does, the fully qualified name of that class should be reported by passing a
Some
forsuiteClassName
. One use for this bit of information is JUnit integration, because the "name" provided to a JUnitorg.junit.runner.Description
appears to usually include a fully qualified class name by convention.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- suiteName
a localized name identifying the suite that is starting, suitable for presenting to the user
- suiteId
a string ID for the suite that is starting, intended to be unique across all suites in a run XXX
- suiteClassName
an optional fully qualifed
Suite
class name of the suite that is starting- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- rerunner
an optional
String
giving the fully qualified name of the class that can be used to rerun the suite that is starting. (IfNone
is passed, the suite cannot be rerun.)- payload
an optional object that can be used to pass custom information to the reporter about the
SuiteStarting
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class Summary(testsSucceededCount: Int, testsFailedCount: Int, testsIgnoredCount: Int, testsPendingCount: Int, testsCanceledCount: Int, suitesCompletedCount: Int, suitesAbortedCount: Int, scopesPendingCount: Int) extends Product with Serializable
Class each of whose instances hold summary information about one ScalaTest run.
Class each of whose instances hold summary information about one ScalaTest run.
- testsSucceededCount
the number of tests that were reported as succeeded during the run
- testsFailedCount
the number of tests that were reported as failed during the run
- testsIgnoredCount
the number of tests that were were reported as ignored during the run
- testsPendingCount
the number of tests that were reported as pending during the run
- testsCanceledCount
the number of tests that were reported as canceled during the run
- suitesCompletedCount
the number of suites that were reported as completed during the run
- suitesAbortedCount
the number of suites that were reported as aborted during the run
- scopesPendingCount
the number of scopes that were reported as pending during the run
- final case class TestCanceled(ordinal: Ordinal, message: String, suiteName: String, suiteId: String, suiteClassName: Option[String], testName: String, testText: String, recordedEvents: IndexedSeq[RecordableEvent], throwable: Option[Throwable] = None, duration: Option[Long] = None, formatter: Option[Formatter] = None, location: Option[Location] = None, rerunner: Option[String] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with ExceptionalEvent with Product with Serializable
Event that indicates a test was canceled, i.e., it couldn't run because some precondition was not met.
Event that indicates a test was canceled, i.e., it couldn't run because some precondition was not met.
To create instances of this class you may use the factory methods. For example, given a report function named
report
, you could fire aTestCanceled
event like this:report(TestCanceled(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName), testName))
The suite class name parameter is optional, because suites in ScalaTest are an abstraction that need not necessarily correspond to one class. Nevertheless, in most cases each suite will correspond to a class, and when it does, the fully qualified name of that class should be reported by passing a
Some
forsuiteClassName
. One use for this bit of information is JUnit integration, because the "name" provided to a JUnitorg.junit.runner.Description
appears to usually include a fully qualified class name by convention.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- message
a localized message suitable for presenting to the user
- suiteName
a localized name identifying the suite containing the test that was canceled, suitable for presenting to the user
- suiteId
a string ID for the suite containing the test that was canceled, intended to be unique across all suites in a run
- suiteClassName
an optional fully qualifed
Suite
class name containing the test that was canceled- testName
the name of the test that was canceled
- testText
the text of the test that was canceled (may be the test name, or a suffix of the test name)
- recordedEvents
recorded events in the test.
- throwable
an optional
Throwable
that, if aSome
, indicates why the test was canceled, or aThrowable
created to capture stack trace information about the problem.- duration
an optional amount of time, in milliseconds, that was required to run the test that was canceled
- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- rerunner
an optional
String
giving the fully qualified name of the class that can be used to rerun the test that has canceled. (IfNone
is passed, the test cannot be rerun.)- payload
an optional object that can be used to pass custom information to the reporter about the
TestCanceled
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class TestFailed(ordinal: Ordinal, message: String, suiteName: String, suiteId: String, suiteClassName: Option[String], testName: String, testText: String, recordedEvents: IndexedSeq[RecordableEvent], analysis: IndexedSeq[String], throwable: Option[Throwable] = None, duration: Option[Long] = None, formatter: Option[Formatter] = None, location: Option[Location] = None, rerunner: Option[String] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with ExceptionalEvent with Product with Serializable
Event that indicates a suite (or other entity) has completed running a test that failed.
Event that indicates a suite (or other entity) has completed running a test that failed.
For example, trait
Suite
usesTestFailed
to report that a test method of aSuite
completed abruptly with anException
.To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aTestFailed
event like this:report(TestFailed(ordinal, userFriendlyName, message, suiteName, Some(thisSuite.getClass.getName), testName))
The suite class name parameter is optional, because suites in ScalaTest are an abstraction that need not necessarily correspond to one class. Nevertheless, in most cases each suite will correspond to a class, and when it does, the fully qualified name of that class should be reported by passing a
Some
forsuiteClassName
. One use for this bit of information is JUnit integration, because the "name" provided to a JUnitorg.junit.runner.Description
appears to usually include a fully qualified class name by convention.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- message
a localized message suitable for presenting to the user
- suiteName
a localized name identifying the suite containing the test that has failed, suitable for presenting to the user
- suiteId
a string ID for the suite containing the test that has failed, intended to be unique across all suites in a run
- suiteClassName
an optional fully qualifed
Suite
class name containing the test that has failed- testName
the name of the test that has failed
- testText
the text of the test that has failed (may be the test name, or a suffix of the test name)
- recordedEvents
recorded events in the test.
- throwable
an optional
Throwable
that, if aSome
, indicates why the test has failed, or aThrowable
created to capture stack trace information about the problem.- duration
an optional amount of time, in milliseconds, that was required to run the test that has failed
- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- rerunner
an optional
String
giving the fully qualified name of the class that can be used to rerun the test that has failed. (IfNone
is passed, the test cannot be rerun.)- payload
an optional object that can be used to pass custom information to the reporter about the
TestFailed
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class TestIgnored(ordinal: Ordinal, suiteName: String, suiteId: String, suiteClassName: Option[String], testName: String, testText: String, formatter: Option[Formatter] = None, location: Option[Location] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a suite (or other entity) has ignored a test.
Event that indicates a suite (or other entity) has ignored a test.
For example, trait
Suite
usesTestIgnored
to report that a test method of aSuite
was ignored because it was annotated with@Ignore
. Ignored tests will not be run, but will usually be reported as reminder to fix the broken test.To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aTestIgnored
event like this:report(TestIgnored(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName), testName))
The suite class name parameter is optional, because suites in ScalaTest are an abstraction that need not necessarily correspond to one class. Nevertheless, in most cases each suite will correspond to a class, and when it does, the fully qualified name of that class should be reported by passing a
Some
forsuiteClassName
. One use for this bit of information is JUnit integration, because the "name" provided to a JUnitorg.junit.runner.Description
appears to usually include a fully qualified class name by convention.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- suiteName
a localized name identifying the suite containing the test that was ignored, suitable for presenting to the user
- suiteId
a string ID for the suite containing the test that was ignored, intended to be unique across all suites in a run
- suiteClassName
an optional fully qualifed
Suite
class name containing the test that was ignored- testName
the name of the test that was ignored
- testText
the text of the test that was ignored (may be the test name, or a suffix of the test name)
- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- payload
an optional object that can be used to pass custom information to the reporter about the
TestIgnored
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class TestPending(ordinal: Ordinal, suiteName: String, suiteId: String, suiteClassName: Option[String], testName: String, testText: String, recordedEvents: IndexedSeq[RecordableEvent], duration: Option[Long] = None, formatter: Option[Formatter] = None, location: Option[Location] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a test is pending, i.e., it hasn't yet been implemented.
Event that indicates a test is pending, i.e., it hasn't yet been implemented.
To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aTestPending
event like this:report(TestPending(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName), testName))
The suite class name parameter is optional, because suites in ScalaTest are an abstraction that need not necessarily correspond to one class. Nevertheless, in most cases each suite will correspond to a class, and when it does, the fully qualified name of that class should be reported by passing a
Some
forsuiteClassName
. One use for this bit of information is JUnit integration, because the "name" provided to a JUnitorg.junit.runner.Description
appears to usually include a fully qualified class name by convention.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- suiteName
a localized name identifying the suite containing the test that is pending, suitable for presenting to the user
- suiteId
a string ID for the suite containing the test that is pending, intended to be unique across all suites in a run
- suiteClassName
an optional fully qualifed
Suite
class name containing the test that is pending- testName
the name of the test that is pending
- testText
the text of the test that is pending (may be the test name, or a suffix of the test name)
- recordedEvents
recorded events in the test.
- duration
an optional amount of time, in milliseconds, that was required to run the test that is pending
- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- payload
an optional object that can be used to pass custom information to the reporter about the
TestPending
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class TestStarting(ordinal: Ordinal, suiteName: String, suiteId: String, suiteClassName: Option[String], testName: String, testText: String, formatter: Option[Formatter] = None, location: Option[Location] = None, rerunner: Option[String] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a suite (or other entity) is about to start running a test.
Event that indicates a suite (or other entity) is about to start running a test.
For example, trait
Suite
usesTestStarting
to report that a test method of aSuite
is about to be invoked.To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aTestStarting
event like this:report(TestStarting(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName), testName))
The suite class name parameter is optional, because suites in ScalaTest are an abstraction that need not necessarily correspond to one class. Nevertheless, in most cases each suite will correspond to a class, and when it does, the fully qualified name of that class should be reported by passing a
Some
forsuiteClassName
. One use for this bit of information is JUnit integration, because the "name" provided to a JUnitorg.junit.runner.Description
appears to usually include a fully qualified class name by convention.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- suiteName
a localized name identifying the suite containing the test that is starting, suitable for presenting to the user
- suiteId
a string ID for the suite containing the test that is starting, intended to be unique across all suites in a run
- suiteClassName
an optional fully qualifed
Suite
class name containing the test that is starting- testName
the name of the test that is starting
- testText
the text of the test that is starting (may be the test name, or a suffix of the test name)
- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- rerunner
an optional
String
giving the fully qualified name of the class that can be used to rerun the test that is starting. (IfNone
is passed, the test cannot be rerun.)- payload
an optional object that can be used to pass custom information to the reporter about the
TestStarting
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class TestSucceeded(ordinal: Ordinal, suiteName: String, suiteId: String, suiteClassName: Option[String], testName: String, testText: String, recordedEvents: IndexedSeq[RecordableEvent], duration: Option[Long] = None, formatter: Option[Formatter] = None, location: Option[Location] = None, rerunner: Option[String] = None, payload: Option[Any] = None, threadName: String = Thread.currentThread.getName, timeStamp: Long = (new Date).getTime) extends Event with Product with Serializable
Event that indicates a suite (or other entity) has completed running a test that succeeded.
Event that indicates a suite (or other entity) has completed running a test that succeeded.
For example, trait
Suite
usesTestSucceeded
to report that a test method of aSuite
returned normally (without throwing anException
).To create instances of this class you may use the factory method. For example, given a report function named
report
, you could fire aTestSucceeded
event like this:report(TestSucceeded(ordinal, userFriendlyName, suiteName, Some(thisSuite.getClass.getName), testName))
The suite class name parameter is optional, because suites in ScalaTest are an abstraction that need not necessarily correspond to one class. Nevertheless, in most cases each suite will correspond to a class, and when it does, the fully qualified name of that class should be reported by passing a
Some
forsuiteClassName
. One use for this bit of information is JUnit integration, because the "name" provided to a JUnitorg.junit.runner.Description
appears to usually include a fully qualified class name by convention.- ordinal
an
Ordinal
that can be used to place this event in order in the context of other events reported during the same run- suiteName
a localized name identifying the suite containing the test that has succeeded, suitable for presenting to the user
- suiteId
a string ID for the suite containing the test that has succeeded, intended to be unique across all suites in a run
- suiteClassName
an optional fully qualifed
Suite
class name containing the test that has succeeded- testName
the name of the test that has succeeded
- testText
the text of the test that has succeeded (may be the test name, or a suffix of the test name)
- recordedEvents
recorded events in the test.
- duration
an optional amount of time, in milliseconds, that was required to run the test that has succeeded
- formatter
an optional
Formatter
that provides extra information that can be used by reporters in determining how to present this event to the user- location
An optional
Location
that provides information indicating where in the source code an event originated.- rerunner
an optional
String
giving the fully qualified name of the class that can be used to rerun the test that has succeeded. (IfNone
is passed, the test cannot be rerun.)- payload
an optional object that can be used to pass custom information to the reporter about the
TestSucceeded
event- threadName
a name for the
Thread
about whose activity this event was reported- timeStamp
a
Long
indicating the time this event was reported, expressed in terms of the number of milliseconds since the standard base time known as "the epoch": January 1, 1970, 00:00:00 GMT
- final case class TopOfClass(className: String) extends Location with Product with Serializable
The location in a source file where the class whose by the fully qualified name is passed as
className
is declared.The location in a source file where the class whose by the fully qualified name is passed as
className
is declared.- className
the fully qualified class name
- final case class TopOfMethod(className: String, methodId: String) extends Location with Product with Serializable
The location in a source file where the method identified by the passed
methodId
in the class whose fully qualified name is pased asclassName
is declared.The location in a source file where the method identified by the passed
methodId
in the class whose fully qualified name is pased asclassName
is declared. The methodId is obtained by callingtoGenericString
on thejava.lang.reflect.Method
object representing the method.- className
the fully qualified class name
- methodId
the method ID, obtained by calling
toGenericString
on thejava.lang.reflect.Method
object representing the method
Value Members
- case object MotionToSuppress extends Formatter with Product with Serializable
A
Formatter
that indicates reporters may wish to suppress reporting of anEvent
.A
Formatter
that indicates reporters may wish to suppress reporting of anEvent
. "Suppress" means that the event won't be reported to the user.An example is that specification-style suites, such as
FunSpec
, generate output that reads more like a specification. One aspect of this is that generally only a single event should be reported for each test, so that output can appear like this:A Stack (when newly created) - should be empty - should complain when popped
ScalaTest suites should generate two events per test, a
TestStarting
event and either aTestSucceeded
or aTestFailed
event. TheFunSpec
trait does report both events, but passes aMotionToSuppress
along with theTestStarting
event. As a result, TheTestStarting
events have no effect on the output. EachTestSucceeded
orTestFailed
event, which is sent with anIndentedText
formatter instead of aMotionToSuppress
, will generate output, such as "- should be empty
".Reporters may choose to ignore a
MotionToSuppress
. For example, an XML reporter may want to report everything about every event that is fired during a concurrent run, so that the events can be reordered later by reading the complete, but unordered, information from an XML file. In this case, the XML reporter would actually report events that were fired with aMotionToSuppress
, including indicating that the report included a motion to suppress. - case object SeeStackDepthException extends Location with Product with Serializable
Indicates the location should be taken from the stack depth exception, included elsewhere in the event that contained this location.