org.scalatest.testng

trait TestNGSuite

[source: org/scalatest/testng/TestNGSuite.scala]

trait TestNGSuite
extends Suite
A suite of tests that can be run with either TestNG or ScalaTest. This trait allows you to mark any method as a test using TestNG's @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 TestNGSuites 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.

Author
Josh Cough
Direct Known Subclasses:
TestNGWrapperSuite

Method Summary
override 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], properties : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor]) : Unit
Execute this TestNGSuite.
Methods inherited from Suite
nestedSuites, execute, execute, groups, testNames, runTest, runTests, runNestedSuites, suiteName, expectedTestCount
Methods inherited from Assertions
assert, assert, assert, assert, convertToEqualizer, intercept, intercept, 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 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], properties : scala.collection.immutable.Map[java.lang.String, Any], distributor : scala.Option[Distributor]) : Unit
Execute this TestNGSuite.
Parameters
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 Suites could be put to be executed by another entity, such as concurrently by a pool of threads. If None, nested Suites will be executed sequentially. Because TestNG handles its own concurrency, this class ignores this parameter.

Overrides
Suite.execute


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