|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
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.
Field Summary | |
---|---|
private java.lang.String |
_name
|
private long |
_startTime
|
private long |
_stopTime
|
Constructor Summary | |
---|---|
TestCase(java.lang.String name)
Construct a test case with the given name |
Method Summary | |
---|---|
void |
assertEquals(java.lang.Object first,
java.lang.Object second,
java.lang.String msg)
Assert the equality of two objects. |
void |
assertExpr(boolean passed,
java.lang.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(java.lang.String msg)
Fail a test. |
int |
getExecutionTime()
Get the execution time of this test case. |
java.lang.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 |
Field Detail |
---|
private java.lang.String _name
private long _startTime
private long _stopTime
Constructor Detail |
---|
public TestCase(java.lang.String name)
Method Detail |
---|
public abstract void check() throws TestFailedException
TestFailedException
public void assertExpr(boolean passed, java.lang.String msg) throws TestFailedException
TestFailedException
public void assertEquals(java.lang.Object first, java.lang.Object second, java.lang.String msg) throws TestFailedException
TestFailedException
public void fail(java.lang.String msg) throws TestFailedException
TestFailedException
public int getExecutionTime()
public java.lang.String getName()
public void init() throws java.lang.Exception
java.lang.Exception
public abstract void run() throws java.lang.Exception
java.lang.Exception
public void startTimer()
public void stopTimer()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |