|
|
Scala 2.3.3
|
object
SUnit
extends java.lang.Object
with scala.ScalaObject
Unit 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 (val tf <- r.failures()) {
Console.println(tf.toString())
}
| Class Summary | |
case
|
class
AssertFailed
an AssertFailed is thrown for a failed assertion |
class
TestCase
The class TestCase defines the fixture to run multiple
tests.
|
|
class
TestFailure
The class TestFailure collects a failed test together
with the thrown exception.
|
|
class
TestResult
a TestResult collects the result of executing a test case |
|
class
TestSuite
The class TestSuite runs a composite of test cases.
|
|
| Trait Summary | |
abstract
|
trait
Assert
this class defined useful assert methods |
abstract
|
trait
Test
a Test can be run with its result being collected |
| Constructor Summary | |
def
this
|
|
| Trait Detail |
abstract
trait
Assert
extends java.lang.Object
with scala.ScalaObject
| Def Detail |
def
assertEquals
[A](expected: A, actual: => A): scala.Unit
def
assertEquals
[A](msg: java.lang.String, expected: A, actual: => A): scala.Unit
def
assertFalse
(actual: => scala.Boolean): scala.Unit
def
assertFalse
(msg: java.lang.String, actual: => scala.Boolean): scala.Unit
def
assertNotNull
(actual: => java.lang.Object): scala.Unit
def
assertNotNull
(msg: java.lang.String, actual: => java.lang.Object): scala.Unit
def
assertNotSame
(expected: => java.lang.Object, actual: => java.lang.Object): scala.Unit
def
assertNotSame
(msg: java.lang.String, expected: => java.lang.Object, actual: => java.lang.Object): scala.Unit
def
assertNull
(actual: => java.lang.Object): scala.Unit
def
assertNull
(msg: java.lang.String, actual: => java.lang.Object): scala.Unit
def
assertSame
(expected: => java.lang.Object, actual: => java.lang.Object): scala.Unit
def
assertSame
(msg: java.lang.String, expected: => java.lang.Object, actual: => java.lang.Object): scala.Unit
def
assertTrue
(actual: => scala.Boolean): scala.Unit
def
assertTrue
(msg: java.lang.String, actual: => scala.Boolean): scala.Unit
def
fail
(msg: java.lang.String): scala.Unit
AssertFailed with given message msg.
abstract
trait
Test
extends java.lang.Object
with scala.ScalaObject
| Def Summary | |
abstract
|
def
run
(r: SUnit.this.TestResult)
: scala.Unit
|
| Def Detail |
| Constructor Detail |