Java Swing is a Java GUI toolkit for building user interfaces. Testing Swing means considering not only widget behavior, but also how people use and perceive the interface. section 8.0
Swing UI testing can consider three aspects:
- Internal plumbing and utilities. section 8.1
- Rendering and layout. section 8.1
- Interaction. section 8.1
Swing is influenced by Model-View-Controller (MVC), but combines view and controller in one component. To test their logic, instantiate widgets in a simple window and operate them programmatically; this can make tests slower or harder to run on headless build servers. section 8.2
Figure 8.1. The MVC triad and its relationships. The controller acts on the model based on input from the view, the model worries about domain logic unaware of any details of the view or the controller, and the view registers with the model for change notifications and renders the data it obtains from the model.
The diagram shows how MVC divides input handling, domain logic, and presentation. section 8.2
