Class GWTTestCase

public class GWTTestCase
extends TestCase
Acts as a bridge between the JUnit environment and the GWT environment. We hook the run method and stash the TestResult object for later communication between the test runner and the unit test shell that drives the test case inside a hosted browser.

There are two versions of this class. One is used in hosted mode and the other is used in hybrid mode. Implementations are very different between the two modes, making it simpler to have a separate implementation for each. Please see the translatable subpackage for the other implementation.

Methods

addCheckpoint(String)Accumulates messages that are printed along with failures (useful in hybrid mode as a substitute for stack traces).
catchExceptions()Determines whether or not exceptions will be caught by the test fixture.
clearCheckpoints()Resets the current checkpoint messages.
getCheckpoints()Gets the current checkpoint messages.
getModuleName()Tests can only be run in the context of a module.
run(TestResult)Stashes the TestResult object so that it can be accessed from the unit test shell.
runTest()Runs the test by delegating to the unit test shell.
setUp()Not supported in the current implemenation.
tearDown()Not supported in the current implementation.

Method Detail

addCheckpoint

public void addCheckpoint(String msg)
Accumulates messages that are printed along with failures (useful in hybrid mode as a substitute for stack traces).

Parameters

msg

catchExceptions

public boolean catchExceptions()
Determines whether or not exceptions will be caught by the test fixture.

clearCheckpoints

public void clearCheckpoints()
Resets the current checkpoint messages.

getCheckpoints

public String[] getCheckpoints()
Gets the current checkpoint messages.

getModuleName

public abstract String getModuleName()
Tests can only be run in the context of a module. Therefore, the concrete TestCase must provide an implementation for this method.

Return Value

the fully qualified name of the module to use for this test.

run

public void run(TestResult result)
Stashes the TestResult object so that it can be accessed from the unit test shell.

Parameters

result

runTest

protected void runTest()
     throws Throwable
Runs the test by delegating to the unit test shell.

setUp

protected final void setUp()
     throws Exception
Not supported in the current implemenation.

tearDown

protected void tearDown()
     throws Exception
Not supported in the current implementation.