org.scalatest

trait AbstractSuite

[source: org/scalatest/AbstractSuite.scala]

trait AbstractSuite
extends AnyRef
Trait that defines abstract methods that are implemented in Suite that can be overriden in stackable modification traits.

The main purpose of AbstractSuite is to differentiate core Suite traits, such as Suite, FunSuite, and Spec from stackable modification traits for Suites such as BeforeAndAfterEach, OneInstancePerTest, and ParallelNestedSuiteExecution. Because these stackable traits extend AbstractSuite instead of Suite, you can't define a suite by simply extending one of the stackable traits:

 class MySuite extends BeforeAndAfterEach // Won't compile
 

Instead, you need to extend a core Suite trait and mix the stackable BeforeAndAfterEach trait into that, like this:

 class MySuite extends FunSuite with BeforeAndAfterEach // Compiles fine
 
Author
Bill Venners
Direct Known Subclasses:
BeforeAndAfterAll, BeforeAndAfterEach, OneInstancePerTest, SequentialNestedSuiteExecution, Suite, ConductorMethods

Method Summary
abstract def expectedTestCount (filter : Filter) : Int
The total number of tests that are expected to run when this Suite's run method is invoked.
abstract def nestedSuites : scala.List[Suite]
A List of this Suite object's nested Suites. If this Suite contains no nested Suites, this method returns an empty List.
abstract def run (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
Runs this suite of tests.
protected abstract def runNestedSuites (reporter : Reporter, stopper : Stopper, filter : Filter, configMap : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor], tracker : Tracker) : Unit
Runs zero to many of this suite's nested suites.
protected abstract def runTest (testName : java.lang.String, reporter : Reporter, stopper : Stopper, configMap : scala.collection.immutable.Map[java.lang.String, Any], tracker : Tracker) : Unit
Runs a test.
protected abstract 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
Runs zero to many of this suite's tests.
abstract def tags : scala.collection.immutable.Map[java.lang.String, scala.collection.immutable.Set[java.lang.String]]
A Map whose keys are String tag names with which tests in this Suite are marked, and whose values are the Set of test names marked with each tag. If this Suite contains no tags, this method returns an empty Map.
abstract def testNames : scala.collection.immutable.Set[java.lang.String]
An Set of test names. If this Suite contains no tests, this method returns an empty Set.
protected abstract def withFixture (test : NoArgTest) : Unit
Runs the passed test function with a fixture established by this method.
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
protected abstract def withFixture(test : NoArgTest) : Unit
Runs the passed test function with a fixture established by this method.

This method should set up the fixture needed by the tests of the current suite, invoke the test function, and if needed, perform any clean up needed after the test completes. Because the NoArgTest function passed to this method takes no parameters, preparing the fixture will require side effects, such as reassigning instance vars in this Suite or initializing a globally accessible external database. If you want to avoid reassigning instance vars you can use FixtureSuite.

Parameters
test - the no-arg test function to run with a fixture

abstract def run(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
Runs this suite of tests.
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.
filter - a Filter with which to filter tests based on their tags
configMap - 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.
tracker - a Tracker tracking Ordinals being fired by the current thread.
Throws
NullPointerException - if any passed parameter is null.

protected abstract def runNestedSuites(reporter : Reporter, stopper : Stopper, filter : Filter, configMap : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor], tracker : Tracker) : Unit
Runs zero to many of this suite's nested suites.
Parameters
reporter - the Reporter to which results will be reported
stopper - the Stopper that will be consulted to determine whether to stop execution early.
filter - a Filter with which to filter tests based on their tags
configMap - 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 run by another entity, such as concurrently by a pool of threads. If None, nested Suites will be run sequentially.
tracker - a Tracker tracking Ordinals being fired by the current thread.
Throws
NullPointerException - if any passed parameter is null.

protected abstract 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
Runs zero to many of this suite's tests.
Parameters
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 reported
stopper - the Stopper that will be consulted to determine whether to stop execution early.
filter - a Filter with which to filter tests based on their tags
configMap - a Map of key-value pairs that can be used by the executing Suite of tests.
distributor - an optional Distributor, into which instances of this Suite class that are responsible for executing individual tests contained in this Suite, or groups of this Suite's tests, may be placed so as to be run by another entity, such as concurrently by a pool of threads.
tracker - a Tracker tracking Ordinals being fired by the current thread.
Throws
NullPointerException - if any of testName, reporter, stopper, groupsToInclude, groupsToExclude, or configMap is null.

protected abstract def runTest(testName : java.lang.String, reporter : Reporter, stopper : Stopper, configMap : scala.collection.immutable.Map[java.lang.String, Any], tracker : Tracker) : Unit
Runs 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.
configMap - a Map of key-value pairs that can be used by the executing Suite of tests.
tracker - a Tracker tracking Ordinals being fired by the current thread.
Throws
NullPointerException - if any of testName, reporter, stopper, configMap, or tracker is null.

abstract def testNames : scala.collection.immutable.Set[java.lang.String]
An Set of test names. If this Suite contains no tests, this method returns an empty Set.

Although subclass and subtrait implementations of this method may return a Set whose iterator produces String test names in a well-defined order, the contract of this method does not required a defined order. Subclasses are free to implement this method and return test names in either a defined or undefined order.


abstract def nestedSuites : scala.List[Suite]
A List of this Suite object's nested Suites. If this Suite contains no nested Suites, this method returns an empty List.

abstract def tags : scala.collection.immutable.Map[java.lang.String, scala.collection.immutable.Set[java.lang.String]]
A Map whose keys are String tag names with which tests in this Suite are marked, and whose values are the Set of test names marked with each tag. If this Suite contains no tags, this method returns an empty Map.

Subclasses may implement this method to define and/or discover tags in a custom manner, but overriding method implementations should never return an empty Set as a value. If a tag has no tests, its name should not appear as a key in the returned Map.


abstract def expectedTestCount(filter : Filter) : Int
The total number of tests that are expected to run when this Suite's run method is invoked.
Parameters
filter - a Filter with which to filter tests to count based on their tags


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