Many programmers aren't sure how to meet the challenge of building graphical user interfaces (GUIs) test-first. The typical solution is that GUI code ends up untested, often by policy. This makes things even worse: since there's a policy that says programmers don't have to write unit tests for GUI code, they tend to sneak logic into the GUI code. Defect rates rapidly increase in this code.
Writing tests against Swing code is not only possible, it's reasonably easy and it results in dramatically improved GUI design and code. In this two-day hands-on workshop, students will build a small GUI application from scratch using TDD. The instructor will lead the course in code building activities. Students will be guided through their solution by a combination of instructor demonstration, choreographing, and group design.
Test-Driven Development Review Simple Design Building a standalone view Layout The value of testing aesthetics Component verification Refactoring repetitive Swing code Text fields, labels, and buttons Button clicks and action listeners Lists Tables Scroll panes Images Graphics contexts Button mnemonics Required fields Field edits: JFormattedTextField, DocumentFilter Building a mouseover status bar Using the Swing robot Use of JfcUnit SwingUtilities Mocking The Humble Dialog Box The model-view-presenter (MVP) design pattern MVC vs. MVP