Intensive test-driven development (TDD) and refactoring


Architect, Programmer, Team lead


1 day


Unit test driven development (TDD) is one of the great development process innovations. While associated with Agile development, TDD can be applied to other, more traditional methodologies as well. It brings numerous benefits, including high levels of test coverage, a goal-directed approach to programming and highly maintainable code.

Refactoring approaches quality from another angle: poor quality legacy designs stifle development work and create places for bugs to hide. Refactoring provides a systematic way to clean up and improve design and can be used to carry out large-scale evolutionary redesigns. Superb tool support (particularly in Java) now makes refactoring more cost-effective than rewriting legacy systems in many cases.

TDD tests defects out, while refactoring builds quality in. They work exceptionally well together.


The course illustrates the theory and practice of unit test driven development and refactoring. It is suitable for software developers with moderate programming experience. Deep technical knowledge is not required, so it is suitable for people with previous but not current programming experience. Experience of Java is helpful. Experience of object-oriented design is very helpful.

This course is extremely intensive — these topics would take 2–3 days to cover on most courses. We follow a carefully-planned structure to maximize learning, and previous participants have given the course very high marks, but please be aware this is a challenging day for the participants. There is a small risk minor topics will need to be skipped to keep to the available time.

To augment the short timescale, intensive learning we recommend following up with on-the-job mentoring for 2–3 days a couple of weeks after the course.


The course blends tutorial, numerous instructor-led demonstrations, open discussion and short exercises.

Participants will be expected to follow along with examples on their own PCs but an element of teaching effective use of the development environment is included in the course so this should not require much previous experience.


  • Introduction to automated JUnit tests
  • Challenge for the class: how do you test the test? Is it capable of failing?
  • Writing tests before code: why and how
  • How far should you go when writing automated tests?
  • More advanced use: suites, setting up and tearing down test data, organizing your projects
  • Testing interaction between objects, and the challenges it creates
  • Using stubs in testing
  • Delegating test-supporting behaviour to stub objects
  • The concept of “mock” objects
  • Using mock object libraries to reduce the effort of creating stubs
  • Recognizing good test-driven code
  • Introduction to the second example: code from a real project
  • Finding small problems in the code
  • Driving the IDE’s refactoring tools
  • How refactoring works — the refactoring process
  • Finding big problems in the code
  • Larger-scale refactorings
  • Redesigning code using systematic refactoring
  • Recognizing good design


Not quite what you want? Contact us if you’d like to shorten or lengthen this course, aim it at a different audience, cover particular topics or combine it with our other courses, briefings or services.

Further information and booking

Please contact us for further information or to book this course.