Scala Library
|
|
scala/testing/SUnit.scala
]
object
SUnit
extends
AnyRefUnit testing methods in the spirit of JUnit framework.
Use these classes like this:
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 (tf <- r.failures()) { println(tf.toString()) }
The trait TestConsoleMain
contains this code as
a main
method, for convenience.
Methods inherited from AnyRef | |
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Class Summary | |
trait
|
Assert
extends AnyRef
this class defines useful
assert methods |
case class
|
AssertFailed
(val msg : java.lang.String, val stackTrace : Boolean) extends java.lang.RuntimeException with Product
an AssertFailed is thrown for a failed assertion
|
trait
|
Test
extends AnyRef
a Test can be run with its result being collected
|
abstract class
|
TestCase
(val name : java.lang.String) extends Test with Assert
The class
TestCase defines the fixture to run multiple
tests. |
trait
|
TestConsoleMain
extends AnyRef
|
class
|
TestFailure
(val failedTest : Test, val thrownException : java.lang.Throwable) extends AnyRef
The class
TestFailure collects a failed test together
with the thrown exception. |
class
|
TestResult
extends AnyRef
a TestResult collects the result of executing a test case
|
class
|
TestSuite
(tests : Test*) extends Test with AnyRef
The class
TestSuite runs a composite of test cases. |
Scala Library
|
|