Is it practical to JUnit test a GUI?

I was talking to Doug last week about test driven development in theory and in practice. Most people are prepared to accept the idea of test driven development, but when you look at big projects that you are working on how many have full JUnit tests? To me, it seems that the first place that the rot sets in is in testing a Swing GUI.

Some thoughts on why this is the case are:

GUI development is not always viewed as 'serious' programming. The 'serious' code gets tested (e.g. the core model) but the GUI doesn't. The GUI is written at the end of the development and there is a big rush, so testing is dropped. It's difficult to think how some visual elements could be tested The GUI code is full of dependencies on other classes and it's hard to isolate individual screens It appears tricky to simulate someone typing and clicking buttons I have been trying to produce more thorough GUI tests and the results are:

Resources * JavaWorld article "Automate GUI tests for Swing applications" Nov 1994 * Yahoo Group for Java GUI Testing * list of Junit GUI tools * GUIDancer

ideas testing
It's All In The Game blog (c) 2005-16 by Jez Nicholson