ScalaTest 1.1
|
|
org/scalatest/testng/TestNGSuite.scala
]
trait
TestNGSuite
extends
Suite@Test
annotation, and supports all other TestNG annotations.
Here's an example:
import org.scalatest.testng.TestNGSuite import org.testng.annotations.Test import org.testng.annotations.Configuration import scala.collection.mutable.ListBuffer class MySuite extends TestNGSuite { var sb: StringBuilder = _ var lb: ListBuffer[String] = _ @Configuration { val beforeTestMethod = true } def setUpFixture() { sb = new StringBuilder("ScalaTest is ") lb = new ListBuffer[String] } @Test { val invocationCount = 3 } def easyTest() { sb.append("easy!") assert(sb.toString === "ScalaTest is easy!") assert(lb.isEmpty) lb += "sweet" } @Test { val groups = Array("com.mycompany.groups.SlowTest") } def funTest() { sb.append("fun!") assert(sb.toString === "ScalaTest is fun!") assert(lb.isEmpty) } }
To execute TestNGSuite
s with ScalaTest's Runner
, you must include TestNG's jar file on the class path or runpath.
This version of TestNGSuite
was tested with TestNG version 5.7.
Method Summary | |
override def
|
run
(testName : scala.Option[java.lang.String], reporter : Reporter, stopper : Stopper, filter : Filter, properties : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor], tracker : Tracker) : Unit
Execute this
TestNGSuite . |
protected override final def
|
runNestedSuites
(reporter : Reporter, stopper : Stopper, filter : Filter, configMap : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor], tracker : Tracker) : Unit
Throws
UnsupportedOperationException , because this method is unused by this
trait, given this trait's run method delegates to TestNG to run
its tests. |
protected override final def
|
runTest
(testName : java.lang.String, reporter : Reporter, stopper : Stopper, configMap : scala.collection.immutable.Map[java.lang.String, Any], tracker : Tracker) : Unit
Throws
UnsupportedOperationException , because this method is unused by this
trait, given this trait's run method delegates to TestNG to run
its tests. |
protected override final 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
Throws
UnsupportedOperationException , because this method is unused by this
trait, given this trait's run method delegates to TestNG to run
its tests. |
protected override final def
|
withFixture
(test : NoArgTest) : Unit
Throws
UnsupportedOperationException , because this method is unused by this
class, given this class's run method delegates to JUnit to run
its tests. |
Methods inherited from Suite | |
nestedSuites, execute, execute, execute, execute, tags, groups, testNames, suiteName, pending, pendingUntilFixed, expectedTestCount |
Methods inherited from Assertions | |
assert, assert, assert, assert, convertToEqualizer, intercept, expect, expect, fail, fail, fail, fail |
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 |
override
def
run(testName : scala.Option[java.lang.String], reporter : Reporter, stopper : Stopper, filter : Filter, properties : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor], tracker : Tracker) : Unit
TestNGSuite
.testName -
an optional name of one test to execute. If None
, this class will execute all relevant tests. I.e., None
acts like a wildcard that means execute all relevant tests in this TestNGSuite
.reporter -
The reporter to be notified of test events (success, failure, etc).groupsToInclude -
Contains the names of groups to run. Only tests in these groups will be executed.groupsToExclude -
Tests in groups in this Set will not be executed.stopper -
the Stopper
may be used to request an early termination of a suite of tests. However, because TestNG does not support the notion of aborting a run early, this class ignores this parameter.properties -
a Map
of properties that can be used by the executing Suite
of tests. This class does not use this parameter.distributor -
an optional Distributor
, into which nested Suite
s could be put to be executed by another entity, such as concurrently by a pool of threads. If None
, nested Suite
s will be executed sequentially.
Because TestNG handles its own concurrency, this class ignores this parameter.
UnsupportedOperationException
, because this method is unused by this
class, given this class's run
method delegates to JUnit to run
its tests.
The main purpose of this method implementation is to render a compiler error an attempt
to mix in a trait that overrides withFixture
. Because this
trait does not actually use withFixture
, the attempt to mix
in behavior would very likely not work.
test -
the no-arg test function to run with a fixtureprotected override final
def
runNestedSuites(reporter : Reporter, stopper : Stopper, filter : Filter, configMap : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor], tracker : Tracker) : Unit
UnsupportedOperationException
, because this method is unused by this
trait, given this trait's run
method delegates to TestNG to run
its tests.
The main purpose of this method implementation is to render a compiler error an attempt
to mix in a trait that overrides runNestedSuites
. Because this
trait does not actually use runNestedSuites
, the attempt to mix
in behavior would very likely not work.
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.UnsupportedOperationException -
always.protected override final
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
UnsupportedOperationException
, because this method is unused by this
trait, given this trait's run
method delegates to TestNG to run
its tests.
The main purpose of this method implementation is to render a compiler error an attempt
to mix in a trait that overrides runTests
. Because this
trait does not actually use runTests
, the attempt to mix
in behavior would very likely not work.
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.UnsupportedOperationException -
always.protected override final
def
runTest(testName : java.lang.String, reporter : Reporter, stopper : Stopper, configMap : scala.collection.immutable.Map[java.lang.String, Any], tracker : Tracker) : Unit
UnsupportedOperationException
, because this method is unused by this
trait, given this trait's run
method delegates to TestNG to run
its tests.
The main purpose of this method implementation is to render a compiler error an attempt
to mix in a trait that overrides runTest
. Because this
trait does not actually use runTest
, the attempt to mix
in behavior would very likely not work.
testName -
the name of one test to run.reporter -
the Reporter
to which results will be reportedstopper -
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 Ordinal
s being fired by the current thread.UnsupportedOperationException -
always.
ScalaTest 1.1
|
|