To simulate user input on a GUI, FEST first needs to find the GUI component(s) that will participate in the test. For example, to simulate a user pressing a "ok" button, FEST first needs to find that button.
FEST provides different ways to lookup a GUI component:
Using a unique name for GUI components guarantees that we can always find them, regardless of any change in the GUI (as long as the components have not been removed.) For example, to find a button having the name "ok," we need to set that name in the button before we execute our tests:
Finding components by type is reliable as long as the GUI under test has only one component of such type.
Custom Search Criteria
There are times when the GUI to test does not provide unique names for their components (e.g. legacy applications.) To overcome this limitation, FEST provides a way to specify custom search criteria using a
In this example we create a
GenericTypeMatcher that matches a
JButton containing the text "OK":