|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--junit.framework.Assert | +--junit.framework.TestCase | +--junit.extensions.abbot.ComponentTestFixture
Simple wrapper for testing components under JUnit. Ensures proper setup and cleanup for a GUI environment. Provides methods for automatically placing a GUI component within a frame and properly handling Window showing/hiding (including modal dialogs). Catches exceptions thrown on the event dispatch thread and rethrows them as test failures.
Use showFrame(Component) when testing individual components, or showWindow(Window) when testing a Frame, Dialog, or Window.
Inner Class Summary | |
static class |
ComponentTestFixture.ExceptionCatcher
Provide access to the most recent exception caught on the dispatch thread. |
Field Summary | |
static int |
EVENT_GENERATION_DELAY
Typical delay to wait for a robot event to be translated into a Java event. |
static int |
POPUP_DELAY
|
static int |
WINDOW_DELAY
|
Constructor Summary | |
ComponentTestFixture(String name)
Construct a test case with the given name. |
Method Summary | |
protected ComponentFinder |
getFinder()
Obtain a component finder to look up components. |
protected Resolver |
getResolver()
Obtain a consistent resolver. |
protected Robot |
getRobot()
Return an Abbot robot for basic event generation. |
protected WindowTracker |
getWindowTracker()
Return a WindowTracker instance. |
protected void |
hideWindow(Window w)
Synchronous, safe hide of a window. |
protected void |
installPopup(Component invoker,
JPopupMenu popup)
Install the given popup on the given component. |
void |
runBare()
Override the default TestCase runBare method to ensure propert test harness setup and teardown that won't likely be accidentally overridden by a subclass. |
protected Frame |
showFrame(Component comp)
This method should be invoked to display the component under test. |
protected Frame |
showFrame(Component comp,
Dimension size)
This method should be invoked to display the component under test, when a specific size of frame is desired. |
protected void |
showPopup(JPopupMenu popup,
Component invoker,
int x,
int y)
Safely display a popup, returning when it is visible. |
protected void |
showWindow(Window w)
Safely display a window, avoiding deadlock. |
protected void |
showWindow(Window w,
Dimension size)
Safely display a window, avoiding deadlock. |
protected void |
showWindow(Window w,
Dimension size,
boolean pack)
Safely display a window, avoiding deadlock. |
Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, name, run, run, runTest, setName, setUp, tearDown, toString |
Methods inherited from class junit.framework.Assert |
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int EVENT_GENERATION_DELAY
public static final int WINDOW_DELAY
public static final int POPUP_DELAY
Constructor Detail |
public ComponentTestFixture(String name)
Method Detail |
protected Robot getRobot()
protected WindowTracker getWindowTracker()
protected Frame showFrame(Component comp)
protected Frame showFrame(Component comp, Dimension size)
protected void showWindow(Window w)
protected void showWindow(Window w, Dimension size)
protected void showWindow(Window w, Dimension size, boolean pack)
protected void hideWindow(Window w)
protected void installPopup(Component invoker, JPopupMenu popup)
protected void showPopup(JPopupMenu popup, Component invoker, int x, int y)
protected ComponentFinder getFinder()
protected Resolver getResolver()
public void runBare() throws Throwable
runBare
in class TestCase
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |