|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
---|---|
ComponentFinderTemplate<T extends Component> | Understands a template for finders. |
DialogFinder | Understands a finder for s. |
FrameFinder | Understands a finder for s. |
JFileChooserFinder | Understands a finder for s. |
JOptionPaneFinder | Understands a finder for s. |
WindowFinder |
Understands lookup of s and s. |
WindowFinderTemplate<T extends Window> | Understands a template for finders. |
Support for testing time-consuming tasks.
A good example is the main window of an application beign shown after the user's credentials have been successfully verified. The following are the typical steps to complete such scenario:
The "tricky" part here is step 4. Authentication/authorization can take some time (depending on network traffic, etc.) and we need to wait for the main window to appear in order to continue our test. It is possible to test this scenario with FEST:
loginDialog.textBox("username").enterText("yvonne"); loginDialog.textBox("password").enterText("welcome"); loginDialog.button("login").click(); // now the interesting part, we need to wait till the main window is shown. FrameFixture mainFrame = findFrame("main").using(loginDialog.robot); // we can continue testing the main window.
The "
" method
(statically imported from findFrame
) can lookup a WindowFinder
Frame
(having "main" as its name) with a default timeout of 5 seconds. That means that if in 5 seconds the
frame we are looking for is not found, the test will fail.
We can also specify a custom value for the timeout. For example, we can set the timeout to 10 seconds in two ways:
FrameFixture mainFrame = findFrame("main").withTimeout(10000).using(loginDialog.robot); // or FrameFixture mainFrame = findFrame("main").withTimeout(10, SECONDS).using(loginDialog.robot);
We can also look up Frames by type:
FrameFixture mainFrame = findFrame(MainFrame.class).using(loginDialog.robot);
Something that you may find weird in the code examples is "using(loginDialog.robot)
."
This is necessary because, in a given test, only one instance of
can be
running, to prevent GUI tests from blocking each other on the screen. In another words, in a test class you can
only use one and only one instance of Robot
Robot
.
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |