There are two versions of this class. This version is the binary version that
derives from JUnit's TestCase and handles all the work of starting up
the GWT environment. The other version is a translatable class that is used
within the browser. See the translatable
subpackage for the
translatable implementation.
addCheckpoint(String) | Add a checkpoint message to the current test. |
catchExceptions() | Determines whether or not exceptions will be caught by the test fixture. |
clearCheckpoints() | Clears the accumulated list of checkpoint messages. |
delayTestFinish(int) | Put the current test in asynchronous mode. |
finishTest() | Cause this test to succeed during asynchronous mode. |
getCheckpoints() | Returns the current set of checkpoint messages. |
getModuleName() | Specifies a module to use when running this test case. |
getTestResults() | Returns the overall test results for this unit test. |
run(TestResult) | Stashes result so that it can be accessed during
runTest(). |
runTest() | Runs the test via the JUnitShell environment. |
false
to let exceptions
escape to the browser. This will break the normal JUnit reporting
functionality, but can be useful in web mode with a JavaScript debugger to
pin down where exceptions are originating.true
for normal JUnit behavior, or
false
to disable normal JUnit getException reportingThis method is typically used to test event driven functionality.
Example:
public void testTimer() { // Setup an asynchronous event handler. Timer timer = new Timer() { public void run() { // do some validation logic // tell the test system the test is now done finishTest(); } }; // Set a delay period significantly longer than the // event is expected to take. delayTestFinish(500); // Schedule the event and return control to the test system. timer.schedule(100); }
Calling this method before the test method completes, will undo the effect
of having called delayTestFinish()
. The test will revert to
normal, non-asynchronous mode.
Example:
public void testTimer() { // Setup an asynchronous event handler. Timer timer = new Timer() { public void run() { // do some validation logic // tell the test system the test is now done finishTest(); } }; // Set a delay period significantly longer than the // event is expected to take. delayTestFinish(500); // Schedule the event and return control to the test system. timer.schedule(100); }
null
array of checkpoint messagesresult
so that it can be accessed during
runTest().