ScalaTest 1.1
|
|
trait
ParallelTestExecution
extends
OneInstancePerTestDistributor
is passed to runTests
.
ScalaTest's normal approach for running suites of tests in parallel is to run different suites in parallel, but the tests of any one suite sequentially. This approach should provide sufficient distribution of the work load in most cases, but some suites may encapsulate multiple long-running tests. Such suites may dominate the execution time of the run. If so, mixing in this trait into just those suites will allow their long-running tests to run in parallel with each other, thereby helping to reduce the total time required to run an entire run.
Because this trait extends OneInstancePerTest
,
each test will be run its own instance of the suite's class. This trait overrides the
runTests
method. If no Distributor
is passed to runTests
,
this trait's implementation simply invokes its supertrait OneInstancePerTest
's implementation
of runTests
, which will run each test in its own instance sequentially. If a Distributor
is passed, however, this traits' implementation of runTests
will, for each test, wrap a new instance of the
suite in a special wrapper suite that will invoke just that one test, and passes the wrapper suites to the Distributor
.
The thread or entity that takes a wrapper suite from the Distributor
will invoke run
on the wrapper suite, which will run just one test. In this way, different tests of a suite that mixes in
ParallelTestExecution
will run in parallel.
Method Summary | |
protected def
|
runTests
(testName : scala.Option[java.lang.String], reporter : Reporter, stopper : Stopper, filter : Filter, configMap : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor], tracker : Tracker) : Unit
Run the tests of this suite in parallel.
|
Methods inherited from OneInstancePerTest | |
newInstance |
Methods inherited from AnyRef | |
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Methods inherited from AbstractSuite | |
withFixture (abstract), run (abstract), runNestedSuites (abstract), runTest (abstract), testNames (abstract), nestedSuites (abstract), tags (abstract), expectedTestCount (abstract) |
Method Details |
protected
def
runTests(testName : scala.Option[java.lang.String], reporter : Reporter, stopper : Stopper, filter : Filter, configMap : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor], tracker : Tracker) : Unit
testName -
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 Suite
.reporter -
the Reporter
to which results will be reportedstopper -
the Stopper
that will be consulted to determine whether to stop execution early.filter -
a Filter
with which to filter tests based on their tagsconfigMap -
a Map
of key-value pairs that can be used by the executing Suite
of tests.distributor -
an optional Distributor
, into which to put nested Suite
s to be run by another entity, such as concurrently by a pool of threads. If None
, nested Suite
s will be run sequentially.tracker -
a Tracker
tracking Ordinal
s being fired by the current thread.NullPointerException -
if any of the passed parameters is null
.IllegalArgumentException -
if testName
is defined, but no test with the specified test name exists in this Suite
ScalaTest 1.1
|
|