ScalaTest 0.9.5
|
|
org/scalatest/Reporter.scala
]
trait
Reporter
extends
AnyRef
Reporter
s receive test results via twelve
report methods. Each report method is invoked to pass a particular kind of report to
the reporter. The report methods are:
runStarting
testStarting
testSucceeded
testFailed
testIgnored
suiteStarting
suiteCompleted
suiteAborted
infoProvided
runStopped
runAborted
runCompleted
Reporter
s may be implemented such that they only present some of the reports to the user. For example, you could
define a reporter class whose suiteStarting
method
does nothing. Such a class would always ignore suiteStarting
reports.
The term test as used in the testStarting
, testSucceeded
,
and testFailed
method names
is defined abstractly to enable a wide range of test implementations.
Trait Suite
invokes testStarting
to indicate it is about to invoke one
of its test methods, testSucceeded
to indicate a test method returned normally,
and testFailed
to indicate a test method completed abruptly with an exception.
Although the execution of a Suite
's test methods will likely be a common event
reported via the
testStarting
, testSucceeded
, and testFailed
methods, because
of the abstract definition of “test” used by this
interface, these methods are not limited to this use. Information about any conceptual test
may be reported via the testStarting
, testSucceeded
, and
testFailed
methods.
Likewise, the term suite as used in the suiteStarting
, suiteAborted
,
and suiteCompleted
method names
is defined abstractly to enable a wide range of suite implementations.
Object Runner
invokes suiteStarting
to indicate it is about to invoke
execute
on a
Suite
, suiteCompleted
to indicate a Suite
's
execute
method returned normally,
and suiteAborted
to indicate a Suite
's execute
method completed abruptly with an exception.
Similarly, class Suite
invokes suiteStarting
to indicate it is about to invoke
execute
on a
nested Suite
, suiteCompleted
to indicate a nested Suite
's
execute
method returned normally,
and suiteAborted
to indicate a nested Suite
's execute
method completed abruptly with an exception.
Although the execution of a Suite
's execute
method will likely be a
common event reported via the
suiteStarting
, suiteAborted
, and suiteCompleted
methods, because
of the abstract definition of "suite" used by this
interface, these methods are not limited to this use. Information about any conceptual suite
may be reported via the suiteStarting
, suiteAborted
, and
suiteCompleted
methods.
Extensibility
You can create classes that extend Reporter
to report test results in custom ways, and to
report custom information passed to Report
subclass instances. For more information on the latter
use case, see the Extensibility section of the Report
documentation.
Reporter
classes can handle invocations of its report methods in any manner, including doing nothing.
For convenience, trait Reporter
includes a default implentation of each report method that does nothing.
Method Summary | |
def
|
dispose
: Unit
Release any non-memory finite resources, such as file handles, held by this
Reporter . Clients should
call this method when they no longer need the Reporter , before releasing the last reference
to the Reporter . After this method is invoked, the Reporter may be defunct,
and therefore not usable anymore. If the Reporter holds no resources, it may do nothing when
this method is invoked. |
def
|
infoProvided
(report : Report) : Unit
Provides information that is not appropriate to report via any other
Reporter method. |
def
|
runAborted
(report : Report) : Unit
Indicates a runner encountered an error while attempting to run a suite of tests.
Object |
def
|
runCompleted
: Unit
Indicates a runner has completed running a suite of tests.
FIX
Class
Object |
def
|
runStarting
(testCount : Int) : Unit
Indicates a runner is about run a suite of tests.
|
def
|
runStopped
: Unit
Indicates a runner has stopped running a suite of tests prior to completion, likely
because of a stop request.
FIX ME
If a stop is requested via |
def
|
suiteAborted
(report : Report) : Unit
Indicates the execution of a suite of tests has aborted, likely because of an error, prior
to completion.
|
def
|
suiteCompleted
(report : Report) : Unit
Indicates a suite of tests has completed executing.
|
def
|
suiteStarting
(report : Report) : Unit
Indicates a suite of tests is about to start executing.
|
def
|
testFailed
(report : Report) : Unit
Indicates a suite (or other entity) has completed running a test that failed.
|
def
|
testIgnored
(report : Report) : Unit
Indicates a suite (or other entity) is annotated as a ignore test.
|
def
|
testStarting
(report : Report) : Unit
Indicates a suite (or other entity) is about to start a test.
|
def
|
testSucceeded
(report : Report) : Unit
Indicates a suite (or other entity) has completed running a test that succeeded.
|
Methods inherited from AnyRef | |
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Method Details |
Object Runner
invokes runStarting
to report
that the first execute
method of a run's starting Suite
s
is about to be invoked.
testCount -
the number of tests expected during this runIllegalArgumentException -
if expectedTestsCount
is less than zero.
Trait Suite
uses testStarting
to report
that a test method of a Suite
is about to be invoked.
report -
a Report
that encapsulates the test starting event to report.NullPointerException -
if report
reference is null
Trait Suite
uses testSucceeded
to report
that a test method of a Suite
returned normally
(without throwing an Exception
).
report -
a Report
that encapsulates the test succeeded event to report.NullPointerException -
if report
reference is null
Trait Suite
uses testIgnored
to report
that a test method of a Suite
is annotated as @Ignore.
Ignored test will not be run, but will be reported as reminder to fix the broken test.
report -
a Report
that encapsulates the ignored test event to report.NullPointerException -
if report
reference is null
Trait Suite
uses testFailed
to report
that a test method of a Suite
completed abruptly with an Exception
.
report -
a Report
that encapsulates the test failed event to report.NullPointerException -
if report
reference is null
Trait Suite
and Object Runner
use suiteStarting
to report
that the execute
method of a Suite
is about to be invoked.
report -
a Report
that encapsulates the suite starting event to report.NullPointerException -
if report
reference is null
Trait Suite
and Object Runner
use suiteCompleted
to report
that the execute
method of a Suite
has returned normally (without throwing a RuntimeException
).
report -
a Report
that encapsulates the suite completed event to report.NullPointerException -
if report
reference is null
Trait Suite
and Object Runner
use suiteAborted
to report
that the execute
method of a Suite
has completed abruptly with a RuntimeException
.
report -
a Report
that encapsulates the suite aborted event to report.NullPointerException -
if report
reference is null
Reporter
method.report -
a Report
that encapsulates the event to report.NullPointerException -
if report
reference is null
def
runStopped : Unit
FIX ME
Suite
's execute
method takes a Stopper
, whose stopRequested
method indicates a stop was requested. Code responsible for running tests and suites, such as the
a boolean
parameter. If false
is passed to
setStopRequested
while a Suite
of tests is running, the
execute
method of all Suite
's should promptly
return even if they haven't finished running all of their tests.
If a stop is requested via Suite
's static setStopRequested
method, class Runner
invokes runStopped
when the execute
method of the run's starting Suite
returns.
If a stop is not requested, class Runner
invokes runCompleted
when the last execute
method of the run's starting Suite
s returns.
Object Runner
invokes runAborted
if the
execute
method of any of the run's starting Suite
s completes
abruptly with a Throwable
.
report -
a Report
that encapsulates the run aborted event to report.NullPointerException -
if report
reference is null
def
runCompleted : Unit
FIX
Class Suite
has a static method setStopRequested
, which takes
a boolean
parameter. If false
is passed to
setStopRequested
while a Suite
of tests is running, the
execute
method of all Suite
's should promptly
return even if they haven't finished running all of their tests.
Object Runner
invokes runFinished
when the last execute
method of the run's starting Suite
s returns,
unless a stop is requested. If a stop is requested
via Suite
's static setStopRequested
method, class Runner
invokes runStopped
when the last execute
method of the run's
starting Suite
s returns.
def
dispose : Unit
Reporter
. Clients should
call this method when they no longer need the Reporter
, before releasing the last reference
to the Reporter
. After this method is invoked, the Reporter
may be defunct,
and therefore not usable anymore. If the Reporter
holds no resources, it may do nothing when
this method is invoked.
ScalaTest 0.9.5
|
|