|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiva.util.jester.TestCase
public abstract class TestCase
An abstract superclass for all test cases. This is intended for subclassing (generally anonymously), and to be passed to a TestHarness for execution. Subclasses are required to implement the run() and check() methods, and can optionally override the failed() method. Note that test suites may choose to subclass this with another abstract class, and then to anonymously override that new class in the methods. This allows, for example, the addition of methods for setting up scenarios shared by multiple tests, common result testing methods, and so on.
Constructor Summary | |
---|---|
TestCase(String name)
Construct a test case with the given name |
Method Summary | |
---|---|
void |
assertEquals(Object first,
Object second,
String msg)
Assert the equality of two objects. |
void |
assertExpr(boolean passed,
String msg)
Make an assertion, and fail the test if it isn't satisfied. |
abstract void |
check()
Report on the results of running the test. |
void |
fail(String msg)
Fail a test. |
int |
getExecutionTime()
Get the execution time of this test case. |
String |
getName()
Get the name of this test case |
void |
init()
Initialize the test case. |
abstract void |
run()
Run the test case. |
void |
startTimer()
Start the execution timer. |
void |
stopTimer()
Stop the execution timer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TestCase(String name)
Method Detail |
---|
public abstract void check() throws TestFailedException
TestFailedException
public void assertExpr(boolean passed, String msg) throws TestFailedException
TestFailedException
public void assertEquals(Object first, Object second, String msg) throws TestFailedException
TestFailedException
public void fail(String msg) throws TestFailedException
TestFailedException
public int getExecutionTime()
public String getName()
public void init() throws Exception
Exception
public abstract void run() throws Exception
Exception
public void startTimer()
public void stopTimer()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |