Skip to content
Testing Swing Application
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Part 01 - Introduction
Part 02 - Refactor UI Logic
Part 03 - Mocking
Part 04 - Multithreading
Part 0n
img
.gitignore
LICENSE
README.md

README.md

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.

Overview

The tutorial comprises the following

  1. Part 1 - Introduction: Introduce the problem and shows the limitations found when we tightly integrate the UI logic within the UI itself.

  2. 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.

  3. Part 3 - Mocking: Describes how to test the UI logic and mocking the UI (referred to as the view).

  4. 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.

  1. Spring Source Tool Suite: https://spring.io/tools3/sts/all
  2. Maven: http://maven.apache.org/
  3. EasyMock: http://easymock.org/
  4. JUnit: http://junit.org/
  5. Jenkins (Continuous Integration): http://jenkins-ci.org/
  6. Hudson (Continuous Integration): http://hudson-ci.org/

Tutorial

Testing Swing Application

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.

Videos Resolution

Help

Should you have any queries, please do not hesitate to contact me at: albert@javacreed.com or through LinkedIn.

Recommended Books

  1. Accelerate by Nicole Forsgren, Jez Humble and Gene Kim
  2. Refactoring: second edition by Martin Fowler
You can’t perform that action at this time.