Returns an Alerter
that during test execution will forward strings (and other objects) passed to its
apply
method to the current reporter.
Returns an Alerter
that during test execution will forward strings (and other objects) passed to its
apply
method to the current reporter. If invoked in a constructor, it
will register the passed string for forwarding later during test execution. If invoked while this
Spec
is being executed, such as from inside a test function, it will forward the information to
the current reporter immediately. If invoked at any other time, it will
print to the standard output. This method can be called safely by any thread.
The total number of tests that are expected to run when this Spec
's run
method is invoked.
The total number of tests that are expected to run when this Spec
's run
method is invoked.
This trait's implementation of this method returns the sum of:
testNames
List
, minus the number of tests marked as ignored and
any tests that are exluded by the passed Filter
expectedTestCount
on every nested Suite
contained in
nestedSuites
This trait's implementation of this method will first ensure that the discovery of scope objects and test methods has been performed.
a Filter
with which to filter tests to count based on their tags
the expected number test count
Returns an Informer
that during test execution will forward strings passed to its
apply
method to the current reporter.
Returns an Informer
that during test execution will forward strings passed to its
apply
method to the current reporter. If invoked in a constructor, it
will register the passed string for forwarding later during test execution. If invoked from inside a scope,
it will forward the information to the current reporter immediately. If invoked from inside a test function,
it will record the information and forward it to the current reporter only after the test completed, as recordedEvents
of the test completed event, such as TestSucceeded
. If invoked at any other time, it will print to the standard output.
This method can be called safely by any thread.
Returns a Documenter
that during test execution will forward strings passed to its
apply
method to the current reporter.
Returns a Documenter
that during test execution will forward strings passed to its
apply
method to the current reporter. If invoked in a constructor, it
will register the passed string for forwarding later during test execution. If invoked from inside a scope,
it will forward the information to the current reporter immediately. If invoked from inside a test function,
it will record the information and forward it to the current reporter only after the test completed, as recordedEvents
of the test completed event, such as TestSucceeded
. If invoked at any other time, it will print to the standard output.
This method can be called safely by any thread.
Returns a Notifier
that during test execution will forward strings (and other objects) passed to its
apply
method to the current reporter.
Returns a Notifier
that during test execution will forward strings (and other objects) passed to its
apply
method to the current reporter. If invoked in a constructor, it
will register the passed string for forwarding later during test execution. If invoked while this
Spec
is being executed, such as from inside a test function, it will forward the information to
the current reporter immediately. If invoked at any other time, it will
print to the standard output. This method can be called safely by any thread.
Runs this fixture.Spec
.
Runs this fixture.Spec
.
If testName
is None
, this trait's implementation of this method
calls these two methods on this object in this order:
runNestedSuites(report, stopper, tagsToInclude, tagsToExclude, configMap, distributor)
runTests(testName, report, stopper, tagsToInclude, tagsToExclude, configMap)
If testName
is defined, then this trait's implementation of this method
calls runTests
, but does not call runNestedSuites
. This behavior
is part of the contract of this method. Subclasses that override run
must take
care not to call runNestedSuites
if testName
is defined. (The
OneInstancePerTest
trait depends on this behavior, for example.)
This trait's implementation of this method will first ensure that the discovery of scope objects and test methods has been performed.
an optional name of one test to run. If None
, all relevant tests should be run.
I.e., None
acts like a wildcard that means run all relevant tests in this fixture.SpecLike
.
the Args
for this run
a Status
object that indicates when all tests and nested suites started by this method have completed, and whether or not a failure occurred.
IllegalArgumentException
if testName
is defined, but no test with the specified test name
exists in this Suite
NullArgumentException
if any passed parameter is null
.
Run a test.
Run a test. This trait's implementation runs the test registered with the name specified by
testName
. Each test's name is a concatenation of the text of all scope objects surrounding a test,
from outside in, and the test method's name, with one space placed between each item. (See the documentation
for testNames
for an example.)
This trait's implementation of this method will first ensure that the discovery of scope objects and test methods has been performed.
the name of one test to execute.
the Args
for this run
a Status
object that indicates when the test started by this method has completed, and whether or not it failed .
NullArgumentException
if testName
or args
is null
.
Run zero to many of this Spec
's tests.
Run zero to many of this Spec
's tests.
an optional name of one test to run. If None
, all relevant tests should be run.
I.e., None
acts like a wildcard that means run all relevant tests in this Spec
.
the Args
for this run
a Status
object that indicates when all tests started by this method have completed, and whether or not a failure occurred.
IllegalArgumentException
if testName
is defined, but no test with the specified test name
exists in this Spec
NullArgumentException
if any of the passed parameters is null
.
Suite style name.
A Map
whose keys are String
tag names to which tests in this Spec
belong, and values
the Set
of test names that belong to each tag.
A Map
whose keys are String
tag names to which tests in this Spec
belong, and values
the Set
of test names that belong to each tag. If this Spec
contains no tags, this method returns an empty Map
.
This trait's implementation returns tags that were passed as strings contained in Tag
objects passed to
methods test
and ignore
.
In addition, this trait's implementation will also auto-tag tests with class level annotations. For example, if you annotate @Ignore at the class level, all test methods in the class will be auto-annotated with @Ignore.
This trait's implementation of this method will first ensure that the discovery of scope objects and test methods has been performed.
An immutable Set
of test names.
An immutable Set
of test names. If this Spec
contains no tests, this method returns an
empty Set
.
This trait's implementation of this method will return a set that contains the names of all registered tests. The set's
iterator will return those names in the order in which the tests were registered. Each test's name is composed
of the concatenation of the name of each surrounding scope object, in order from outside in, and the name of the
test method itself, with all components separated by a space. For example, consider this Spec
:
import org.scalatest.Spec class StackSpec extends Spec { object `A Stack` { object `(when not empty)` { def `must allow me to pop` {} } object `(when not full)` { def `must allow me to push` {} } } }
Invoking testNames
on this Spec
will yield a set that contains the following
two test name strings:
"A Stack (when not empty) must allow me to pop" "A Stack (when not full) must allow me to push"
This trait's implementation of this method will first ensure that the discovery of scope objects and test methods has been performed.
the Set
of test names
Implementation trait for class
fixture.Spec
, which is a sister class toorg.scalatest.Spec
that can pass a fixture object into its tests.fixture.Spec
is a class, not a trait, to minimize compile time given there is a slight compiler overhead to mixing in traits compared to extending classes. If you need to mix the behavior offixture.Spec
into some other class, you can use this trait instead, because classfixture.Spec
does nothing more than extend this trait and add a nicetoString
implementation.See the documentation of the class for a detailed overview of
fixture.Spec
.