| 
 | 
          Scala 1.3.0.7 | |||
 import scala.testing.SUnit;
  import SUnit._;
  class MyTest(n:String) extends TestCase(n) {
    override def runTest() = n match {
      case "myTest1" =>   assertTrue( true );
      case "myTest2" =>   assertTrue( "hello", false );
    }
  }
  val r = new TestResult();
  suite.run(r);
  for(val tf <- r.failures()) {
    Console.println(tf.toString())
  }
}
 
| Trait Summary | |
| trait Assert()this trait defined useful assert methods | |
| trait Test()a Test can be run with its result being collected | |
| Class Summary | |
| 
        case | class AssertFailed(msg: String)an AssertFailed is thrown for a failed assertion | 
| class TestCase(name: String)a TestCase defines the fixture to run multiple tests | |
| class TestFailure(failedTest: Test, thrownException: Throwable)a TestFailure collects a failed test together with the thrown exception | |
| class TestResult()a TestResult collects the result of executing a test case | |
| class TestSuite(tests: Test*)a TestSuite runs a composite of test cases | |
| 
 | 
          Scala 1.3.0.7 | |||