org.scalatest

trait ExecuteAndRun

[source: org/scalatest/ExecuteAndRun.scala]

trait ExecuteAndRun
extends AnyRef
Trait that abstracts out the execute and runTest methods of Suite. This trait exists to support the use of trait BeforeAndAfter, which is a direct subtrait of this trait. The BeforeAndAfter trait's implementation of runTest surrounds an invocation of super.runTest in calls to beforeEach and afterEach. Similarly, the BeforeAndAfter trait's implementation of execute surrounds an invocation of super.execute in calls to beforeAll and afterAll. This enables trait BeforeAndAfter to be mixed into any Suite, but not into a trait that contains shared examples for a Spec.

The main purpose of ExecuteAndRun is to render a compiler error the mistake of attempting to mix BeforeAndAfter into a trait containing shared examples for a Spec. If BeforeAndAfter extended Suite itself, then it would compile if mixed into such a trait, but wouldn't work as expected (i.e., the beforeEach and afterEach methods would never be called). This goal can't be achieved by making the self type of BeforeAndAfter Suite, because in that case BeforeAndAfter couldn't wrap calls to the mixed into Suite, given Suite would not be super, and calling execute on this would result in infinite recursion.

Author
Bill Venners
Direct Known Subclasses:
BeforeAndAfter, Suite

Method Summary
abstract def execute (testName : scala.Option[java.lang.String], reporter : Reporter, stopper : Stopper, groupsToInclude : scala.collection.immutable.Set[java.lang.String], groupsToExclude : scala.collection.immutable.Set[java.lang.String], goodies : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor]) : Unit
Execute this ExecuteAndRun.
protected abstract def runTest (testName : java.lang.String, reporter : Reporter, stopper : Stopper, goodies : scala.collection.immutable.Map[java.lang.String, Any]) : Unit
Run a test.
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
abstract def execute(testName : scala.Option[java.lang.String], reporter : Reporter, stopper : Stopper, groupsToInclude : scala.collection.immutable.Set[java.lang.String], groupsToExclude : scala.collection.immutable.Set[java.lang.String], goodies : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor]) : Unit
Execute this ExecuteAndRun.
Parameters
testName - an optional name of one test to execute. If None, all relevant tests should be executed. I.e., None acts like a wildcard that means execute all relevant tests in this Suite.
reporter - the Reporter to which results will be reported
stopper - the Stopper that will be consulted to determine whether to stop execution early.
groupsToInclude - a Set of String test names to include in the execution of this Suite
groupsToExclude - a Set of String test names to exclude in the execution of this Suite
goodies - 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 Suites to be executed by another entity, such as concurrently by a pool of threads. If None, nested Suites will be executed sequentially.
Throws
NullPointerException - if any passed parameter is null.

protected abstract def runTest(testName : java.lang.String, reporter : Reporter, stopper : Stopper, goodies : scala.collection.immutable.Map[java.lang.String, Any]) : Unit
Run a test.
Parameters
testName - the name of one test to execute.
reporter - the Reporter to which results will be reported
stopper - the Stopper that will be consulted to determine whether to stop execution early.
goodies - a Map of key-value pairs that can be used by the executing Suite of tests.
Throws
NullPointerException - if any of testName, reporter, stopper, or goodies is null.


Copyright (C) 2001-2009 Artima, Inc. All rights reserved.