Practical Objects: Test Driven Development using JUnit

The JUnit testing framework from Kent Beck and Erich Gamma enables a new style of Java development - Test Driven Development. This is a development style that is used in eXtreme Programming that states you should only modify your source code if you have a failing test. By following this development style, your regression test suite is built up as you build your application. The side benefit for developers is that very little time is spent in debugging, since you have a failing test showing that the method you have just written is not working yet. There is no need to search all over the source, you know where to start looking, in the method you are currently working on.

This intensive, "hands-on" course gives participants experience in using Test Driven Development for the programming part of their development process. It covers the basics from verifying the installation of JUnit, through writing Unit Tests for simple methods, through creating Suites of Unit Tests up to Regression Testing applications.

Duration and intended Audience

This is a 2 day intensive, hands on course. The first day focuses on getting familiar with JUnit and understanding how Test Driven Development works, the second on applying JUnit within your current project. The first day of the course is also offered by itself for those projects that are already using JUnit extensively.

Participants should have a working knowledge of Java and OO Design. Familiarity with the UML notation is useful as some sample exercises are documented using UML diagrams.

Course Goals

Course Format

This course is based on continuous exercises and discussions, rather than the slide-based lecture form frequently encountered in industry courses. In each section of the course a concept gets introduced, the participants do an exercise and discuss, and the entire room discusses their results. In this way, each person gets to participate in both exercises and discussions.

Note. This is a Powerpoint free course. Participants learn to do Test Driven Development by writing tests, executing those tests on their implementations of the design and by critiquing tests and code.

Course Content

  1. An introduction to Testing using JUnit
  2. An Introduction to Test Driven Development
  3. Testing Object Oriented Software
  4. Test Driven Development
  5. Bugfixing in Test Driven Development
  6. Retrofitting JUnit into an existing Application
  7. Refactoring Applications to deal with hard to test code
  8. Functional Testing of Websites using HttpUnit

Recommended texts

Back to the Mentoring and Training Page

Pete McBreen, pete@mcbreen.ab.ca