Conclusions
We've completed development of our user interface. Not every aspect of a GUI can be unit-tested through the approach we've used, but we've identified a number of useful techniques:
Even GUI development can maintain the cycle-in-the-small of test-code design.
GUI tests can be robust against changes in how the widgets are arranged on-screen.
Fields and buttons can be simulated with getText(), setText(), doClick(), and so on.
Stub out the services provided by the model to get fine-grained control over what the GUI test shows.
We can test relative positioning using getLocationOnScreen().
Unit tests can be tedious to write, but they save you time in the future (by catching bugs after changes). Less obvious, but just as important, is that they ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access