org.scalatest.junit

trait JUnit3Suite

[source: org/scalatest/junit/JUnit3Suite.scala]

trait JUnit3Suite
extends junit.framework.TestCase with Suite
A suite of tests that can be run with either JUnit 3 or ScalaTest. This trait allows you to write JUnit 3 tests with ScalaTest's more concise assertion syntax as well as JUnit's assertions (assertEquals, etc.). You create tests by defining methods that start with test, and can create fixtures with methods named setUp and tearDown. For example:
 import org.scalatest.junit.JUnit3Suite
 import scala.collection.mutable.ListBuffer

 class TwoSuite extends JUnit3Suite {

   var sb: StringBuilder = _
   var lb: ListBuffer[String] = _

   override def setUp() {
     sb = new StringBuilder("ScalaTest is ")
     lb = new ListBuffer[String]
   }

   def testEasy() {
     sb.append("easy!")
     assert(sb.toString === "ScalaTest is easy!")
     assert(lb.isEmpty)
     lb += "sweet"
   }

   def testFun() {
     sb.append("fun!")
     assert(sb.toString === "ScalaTest is fun!")
     assert(lb.isEmpty)
   }
 }
 

To execute JUnit3Suites with ScalaTest's Runner, you must include JUnit3's jar file on the class path or runpath. This version of JUnit3Suite was tested with JUnit version 3.8.1.

Author
Josh Cough
Bill Venners
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 JUnit3Suite.
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 junit.framework.TestCase
junit.framework.TestCase.countTestCases, junit.framework.TestCase.createResult, junit.framework.TestCase.run, junit.framework.TestCase.run, junit.framework.TestCase.runBare, junit.framework.TestCase.runTest, junit.framework.TestCase.setUp, junit.framework.TestCase.tearDown, junit.framework.TestCase.toString, junit.framework.TestCase.getName, junit.framework.TestCase.setName
Methods inherited from AnyRef
getClass, hashCode, equals, clone, 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 JUnit3Suite.
Parameters
testName - an optional name of one test to execute. If None, all tests will be executed. I.e., None acts like a wildcard that means execute all tests in this JUnit3Suite.
reporter - the Reporter to which results will be reported
groupsToInclude - Contains the names of groups to run. This class ignores this parameter.
groupsToExclude - Tests in groups in this Set will not be executed. This class ignores this parameter.
stopper - the Stopper may be used to request an early termination of a suite of tests. Currently, 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. Currently, this class ignores this parameter.
Throws
NullPointerException - if any passed parameter is null.
Overrides
Suite.execute


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