Testing Swing Application
This tutorial demonstrates how to develop a simple Java Swing (or user interface) application and test the UI related logic using automated tests, such as JUnit (Homepage), using a series of videos compiled as a playlist (Youtube). The application is kept very simple while making use of various technologies, such as EasyMock (Homepage). This tutorial is targeted to college or university students who studied Java but lack experience and would like to do something productive. The main idea of this tutorial is not to learn Java, but to help the viewers to build testable Swing applications. The playlist presented by this tutorial shows how to build a Java Swing application that can be easily tested using automated tests in a step-by-step fashion.
All code for this tutorial is available at: https://github.com/javacreed/testing-swing-application. Each video has its own project and the viewers can download or view all code from the above link. With the exception of the first video, all other videos start from where the previous one left and thus the viewer can use the previous videos’ code as a starting point to the next video. The first video starts by creating a project from scratch.
The tutorial comprises the following
Part 1 - Introduction: Introduce the problem and shows the limitations found when we tightly integrate the UI logic within the UI itself.
Part 2 - Refactor UI Logic: Refactor the project and splits the UI logic away from the UI code. This is the first step in creating testable Swing/UI applications. This part introduces the concept of View and Presenter and provides a clear definition of their boundaries.
Part 3 - Mocking: Describes how to test the UI logic and mocking the UI (referred to as the view).
Part 4 - Multithreading: Shows how the introduction of multiple threads can tamper our tests and provides a simple solution to handle this issue.
The application shown in this tutorial is developed with Spring Tool Suite, also referred to as STS, (Download). The viewers are free to use any integrated development environment, also referred to as IDE, (Wiki), they prefer. In such event, please note that some of the commands or shortcuts may not work on a different IDE and some things may be organised differently. If you are new to Java, it is highly recommended to use the same IDE as the one used in the videos as this will simplify your learning experience. Please note that by no means we are saying that the other IDE are not good or that STS is better than all others. For more information about how to setup your environment please follow the Setting up the Environment tutorial.
Resources and Technologies
Following is a list of resources technologies used in this tutorial. These are shown in the order they appear.
- Spring Source Tool Suite: https://spring.io/tools3/sts/all
- Maven: http://maven.apache.org/
- EasyMock: http://easymock.org/
- JUnit: http://junit.org/
- Jenkins (Continuous Integration): http://jenkins-ci.org/
- Hudson (Continuous Integration): http://hudson-ci.org/
Please note that the videos are recorded in HD (1080p). Make sure to use the correct resolution to make the best out of these videos as shown below.
Should you have any queries, please do not hesitate to contact me at:
email@example.com or through LinkedIn.