org.scalatest.Distributor.scala Maven / Gradle / Ivy
/* * Copyright 2001-2013 Artima, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.scalatest /** * Trait whose instances facilitate parallel execution of
's apply method. For example, aSuite
s. * An optionalDistributor
is passed to therun
method ofSuite
. If a *Distributor
is indeed passed, traitSuite
's implementation ofrun
will * populate thatDistributor
with its nestedSuite
s (by passing them to theDistributor
's *apply
method) rather than executing the nestedSuite
s directly. It is then up to another thread or process * to execute thoseSuite
s. * ** If you have a set of nested
* *Suite
s that must be executed sequentially, you can mix in trait *SequentialNestedSuiteExecution
, which overridesrunNestedSuites
and * callssuper
'srunNestedSuites
implementation, passing inNone
for the *Distributor
. ** Implementations of this trait must be thread safe. *
* * @author Bill Venners */ trait Distributor { /** * Puts aSuite
into theDistributor
. * ** The
Distributor
can decide which, if any, of the passedArgs
SuiteDistributor
* may pass itself wrapped in aSome
in theArgs
it passes to theSuite
'srun
* method instead of theargs.distributor
value. * * * @param suite theSuite
to put into theDistributor
. * @param args aArgs
containing objects that may be passed to theSuite
's *run
method via aArgs
instance. * * @throws NullArgumentException if eithersuite
ortracker
isnull
. */ def apply(suite: Suite, args: Args): Status }