Course 443:
Mastering Test-Driven Development Using JUnit

(3 days)


Course Description

This in-depth workshop will help developers, product managers, and quality engineers hit the ground running with test-driven development skills. This is a comprehensive course on test-driven development that is 50% hands-on and 50% lecture, with multiple mini-projects built in to reinforce skills and concepts learned in the lectures. It covers unit testing, functionality testing, and integration testing. It teaches developers how to write unit tests when using container-managed objects and covers expressive testing using Hamcrest.

Learning Objectives

  • Test business objects and services
  • Follow best practices in test-first development
  • Run unit tests during day-to-day development
  • Best practices in maintaining unit tests
  • Measuring test coverage
  • Identifying design patterns and refactorings
  • Expressive tests using Hamcrest
  • Testing container-managed objects using mocks
  • Testing objects that require dependency injection
  • Testing data-driven classes using DBUnit
  • Testing performance using JUnitPerf
  • Testing GUIs and threaded applications

 Who Should Attend

This is an intermediate level Java programming course designed for developers, product managers, and quality engineers who wish to learn best practices for writing correct and testable programs in Java.


Attendees should be experienced Java programmers. Development experience using Java Enterprise technologies such as servlets, JSPs, EJB, or Spring is helpful.

Course Outline

Chapter 1: Test-Driven Development

  • Why Test-Driven Development?
  • What to Test
  • Forms of Software Testing
  • Tools for Testing
  • Continuous Integration
  • Agile Programming
  • Hands-On Exercises

Chapter 2: Unit Testing with JUnit, TestNG

  • Unit Testing with JUnit
  • Assertions
  • Set Up and Tear Down
  • Testing Exception Throwing
  • Simplifying Tests with JUnit4 Annotations
  • TestNG & Java 5
  • Arrays, Floats, and Autoboxing
  • Hands-On Exercises

Chapter 3: The Testing Lifecycle

  • Unit Testing Patterns
  • Measuring Test Coverage
  • Maintaining Unit Tests
  • Fixing Bugs
  • Refactoring
  • Design Patterns
  • Hands-On Exercises

Chapter 4: Expressive Tests with Hamcrest

  • Matchers
  • Logical Matchers
  • Arrays, Floats, and Strings
  • Custom Matchers
  • Hands-On Exercises

Chapter 5: Functionality Testing

  • Testing Use Cases
  • Testing Container-Managed Components
  • Mock Objects
  • Spring Support for Mock Objects
  • Autowiring of Mock Objects
  • Hands-On Exercises

Chapter 6: Testing Data Access Objects

  • Strategies for Testing Data-Driven Applications
  • Transactional Test Cases
  • DBUnit
  • Hands-On Exercises

Chapter 7: Integration Testing

  • Measuring Performance
  • Timed and Load Tests
  • Testing GUIs
  • Concurrent Tests
  • Hands-On Exercises 

Please Contact Your ROI Representative to Discuss Course Tailoring!