Mastering Test-Driven Development Using JUnit

COURSE OUTLINE:

Description

JUnit and other testing frameworks based on JUnit such as Cactus, make it possible to write higher-quality Java code. It is a powerful tool designed to support robust, predictable, and automated testing development in the Java enterprise application arena.

In this comprehnsive hands-on Test-Driven Development(TDD)/JUnit training course, developers will get up and running with essential test-driven development programming skills using JUnit and various open-source testing frameworks. Using test-driven development techniques, you will learn the best practices for writing great programs in Java and cover essential TDD topics and skills.

Audience

Developers who wish to get up and running on test-driven development immediately

Prerequisites

  • Familiarity with Java and object-oriented technologies
  • Real world programming experience is a must

Learning Objectives

  • JUnit
  • Use the JUnit Test Runner interface
  • JUnit to drive the implementation of Java code
  • Test applications using native IDE support
  • Best practices and patterns for test development
  • JUnit's strengths and weaknesses
  • Role of debugging when done in conjunction with tests
  • Fundamentals of the TDD using Java and its importance, uses, strengths, and weaknesses
  • Basics of JUnit, Cactus, and other testing frameworks and how they relate to TDD
  • Better control the development and quality of Java code
  • How JUnit affects your perspective on development and increases your focus on a task
  • JUnit coding style
  • Create well structured JUnit programs
  • Compile and execute programs using JUnit, Cactus, StrutsTestCase, and DBUnit using the IDE of your choice
  • JUnit testing used for either state-based or interaction-based testing
  • Extend testing with mock objects using EasyMock
  • Refactoring techniques available to make code as reusable/robust as possible
  • Testing techniques
  • The following JUnit-based testing frameworks are examined:
    • JUnit 3.8.1
    • DBUnit
    • jWebUnit
    • StrutsTestCase
    • EasyMock
    • Cactus

1. Test-Driven Development

  • Problem
  • JUnit Solution
  • Test, Code, Refactor, Repeat
  • ROI of TDD
  • Tools to support TDD
  • Automation and Coverage
  • Working With Coverage Analysis
  • Rationale
  • Advantages
  • Tools

2. Testing Frameworks

  • Integration Testing
  • Presentation Testing
  • Integration Testing
  • jWebUnit
  • jWebUnit/HttpUnit
  • Testing Struts
  • Design of a Struts Application
  • StrutsTestCase
  • Testing strategies

3. TDD Tools and Techniques

  • Mock Objects and EasyMock
  • Decoupling with Mock Objects
  • Mock Object Frameworks
  • EasyMock and JUnit
  • Dependency Injection, Spring, and Testing
  • Dependency Injection and IoC
  • Spring Framework
  • Mock Objects and Spring
  • State-Based vs. Interaction-Based Testing
  • State-Based Testing
  • Interaction-Based Testing
  • Dependencies vs. Mock Objects
  • Interaction-Based Testing
  • JUnit and Ant
  • Running JUnit Tests from Ant
  • Generating a JUnitReport

4. Improving Code Quality Through Refactoring

  • Refactoring
  • Sample of Refactorings
  • Refactoring and Testing
  • Suggested Refactoring
  • Impact of Refactoring

5. Additional Testing Frameworks

  • Database Testing
  • Issues of Database Testing
  • Persistence Mechanisms
  • DBUnit

6. TDD and Spring (Optional)

  • Spring Framework
  • Spring Basics
  • Configuring a Spring Bean
  • Property Editors
  • Constructor Injection vs. Setter Injection
  • Wiring the Collaborators

7. Advanced TDD Topics (Optional)

  • Design Patterns
  • Code that Feels Wrong
  • Refactoring to Design Patterns
  • Abstract Factory Design Patterns
  • Adapter Design Patterns
  • Strategy Design Patterns
  • Testing Business Rules
  • Adding Testing to Your Build Process
  • Ant JUnit Tag
  • Ant Build File
  • Continuous Integration

8. Additional Testing Frameworks

  • Server-Side Testing
  • Cactus