Test Driven Development (TDD) and Unit Testing Essentials

Master Test Driven Development with our comprehensive TDD and Unit Testing Essentials course designed for Java developers seeking to enhance their software development skills with JUnit and industry-leading testing frameworks.

Course Thumbnail

Essential Skills Gained

Checkmark

Understand the core principles of Test Driven Development and Unit Testing

Checkmark

Implement effective unit tests using JUnit

Checkmark

Explore and utilize advanced JUnit features and best practices

Checkmark

Leverage mock objects and refactoring to improve code quality

Format

  • Instructor-led
  • 3 days with lectures and hands-on labs.

Audience

  • Software Developers
  • Agile Practitioners
  • Quality Assurance Professionals
  • Project Managers

Description

Test Driven Development (TDD) and Unit Testing Essentials is a three-day, comprehensive hands-on test-driven development / JUnit / TDD training course geared for developers who need to get up and running with essential Test-driven development programming skills using JUnit and various open-source testing frameworks. Throughout the course you'll learn, explore and gain practical experience working with best practices for writing great programs in Java, using test-driven development techniques. This course quickly introduces you to the core features and benefits of JUnit. You'll leave this course armed with the skills required to leverage solid test driven development and unit testing techniques, using the latest industry techniques and best practices. Throughout the course, you’ll work on a project with labs specifically oriented towards using TDD to implement a complex and multi-faceted web application that uses a database in its final form.

Calendar icon

Upcoming Course Dates

August 20-22, 2025

10:00 AM - 6:00 PM

Virtual: Online - US/Eastern

Enroll

$2195

August 20-22, 2025

10:00 AM - 6:00 PM

Virtual: Online - US/Eastern

Enroll

$2195

October 27-29, 2025

10:00 AM - 6:00 PM

Virtual: Online - US/Eastern

Enroll

$2195

Course Outline

Download PDF

Session: Introducing Test-driven Development

  1. Rationale for TDD

  2. The process of TDD

  3. Advantages to TDD

  4. Side-effects of TDD

  5. Tools to support TDD

  6. Tutorial: Setup IntelliJ for Using Maven

Session: Unit Testing using JUnit

  1. Purpose of Unit Testing

  2. Good Unit Tests

  3. Test Stages

  4. Unit Testing Vs Integration Testing

  5. Understanding Unit Testing Frameworks

Lesson: Jumpstart: JUnit 5.x

  1. Understand and work with the features of JUnit

  2. Write unit tests using @Test annotation

  3. Test Result Verification (Assertions)

  4. Manage fixtures using @BeforeEach, @AfterEach, @BeforeAll and @AfterAll annotations

  5. Maven setup using Surefire plugin

  6. Lab: Demo JUnit

  7. Lab: Build JUnit Case Study

  8. Lab: Jumpstart JUnit

Lesson: Annotations

  1. Use @DisplayName to specify a custom name for the test

  2. Check for exceptions thrown by test

  3. Use @Disabled to prevent a test class or method from running

  4. Use timeouts to fail test that take longer than required

  5. Test Execution Order

  6. Lab: Working with @Test Annotation

Lesson: Hamcrest

  1. Learn the notation of assertThat

  2. Know the objective of Hamcrest library

  3. Use Hamcrest's logical and object matchers

  4. Use Hamcrest's number and collection matchers

  5. Lab: Working with Hamcrest

Lesson: Parameterized Tests

  1. The @ParameterizedTest annotation

  2. A parameterized test to test code under several conditions

  3. Define different sources for test data (@ValueSource, @CsvSource, @CsvFileSource, @EnumSource, @MethodSource, @ArgumentSource)

  4. Lab: Working with Parameterized Tests

Lesson: Advanced Features

  1. JUnit 4 vs JUnit 5

  2. Nested Unit Tests

  3. Repeated Tests

  4. JUnit Extensions

  5. ExecutionConditions

  6. Lambda Support

  7. Grouped Assertions

  8. Lab: Working with Advanced Features

Lesson: JUnit Best Practices

  1. "Good" Tests

  2. Bad Smell

  3. White-Box Unit Testing

  4. Black-Box Unit Testing

  5. Automation and Coverage

Session: Mocking

Lesson: Mocking of Components

  1. Why We use Test Dummies

  2. Working with Mock Objects

  3. Using Mocks with the User Interface

  4. Mock Object Strategies

Lesson: Mock Objects and Mockito

  1. Mockito Description and Features

  2. Mockito Object Lifecycle

  3. JUnit 5 and Mockito Dependency Injection

  4. Stubs Using ArgumentMatchers

  5. Verifying Behavior in Mockito

  6. Partial Mock Objects

  7. The Spy annotation

  8. Lab: Mock Object and Mockito

Lesson: PowerMock

  1. PowerMock Description and Features

  2. Using PowerMockito

  3. @PrepareForTest

  4. Mocking a final class or final method

  5. Mocking a Static Method

Session: Advanced Topics

Lesson: State-based vs. Interaction-based Testing

  1. State-based Testing

  2. Interaction-based Testing

  3. Mock Objects Support Each Approach

  4. Three Areas to Check in a Test

  5. Lab: Interaction-based Testing

Lesson: Improving Code Quality Through Refactoring

  1. Refactoring Overview

  2. Refactoring and Testing

  3. Refactoring to Design Patterns

  4. Lab: Refactoring

  5. Lab: Best Practices - Refactoring Tests

Lesson: Database Testing: DbUnit

  1. Setting up DbUnit

  2. Defining a Dataset File in XML, CSV or Excel

  3. Writing a DbUnit Test Class

  4. Assert the results

  5. Use the FailureHandler and ValueComparer

  6. Using Date and Time in test sets

  7. Export a data set

  8. Lab: Introduction to DbUnit

  9. Lab: DbUnit Assertions

  10. Lab: Selenium and DbUnit

Your Team has Unique Training Needs.

Your team deserves training as unique as they are.

Let us tailor the course to your needs at no extra cost.