About the course
Test Driven Development (TDD) is synonymous with Agile software development, and as its name suggests, promotes a "test-first" mentality. Test Driven Development aims to produce better code from the outset, driving towards more efficient and leaner software, getting to market faster, and with less time spent fixing bugs after release.
This Java TDD course provides developers with the essential skills to write robust, maintainable, and high-quality code through Test-Driven Development. You'll learn how to apply TDD principles using JUnit 5 and Mockito, refactor code for testability, and integrate automated testing into your development workflow with CI tools like Jenkins and build tools like Maven and Gradle.
Through hands-on exercises, you'll gain practical experience in writing effective unit tests, applying TDD to real-world scenarios, and mastering the techniques to deliver reliable software.
Instructor-led online and in-house face-to-face options are available - as part of a wider customised training programme, or as a standalone workshop, on-site at your offices or at one of many flexible meeting spaces in the UK and around the World.
-
- Write clean, effective, and maintainable Java code using TDD.
- Master JUnit 5 for unit testing and Mockito for creating test doubles.
- Apply the Red-Green-Refactor cycle to develop software iteratively.
- Refactor existing Java code to improve its testability.
- Integrate automated testing into your development workflow.
- Use Maven or Gradle to manage dependencies and build your projects.
- Set up a continuous integration pipeline with Jenkins.
- Understand and apply key TDD principles and best practices.
- Design and write unit tests for a variety of Java applications.
- Identify and address common TDD anti-patterns.
-
This course is designed for existing Java developers who want to write cleaner, more maintainable, and robust code through Test-Driven Development (TDD).
-
To get the most out of this course, you should have attended our Java Programming training course, or have equivalent experience:
Solid understanding of Java programming
Familiarity with object-oriented programming concepts
Experience with a Java IDE (e.g., IntelliJ IDEA, Eclipse)
-
This Java TDD course is available for private / custom delivery for your team - as an in-house face-to-face workshop at your location of choice, or as online instructor-led training via MS Teams (or your own preferred platform).
Get in touch to find out how we can deliver tailored training which focuses on your project requirements and learning goals.
-
Introduction to Testing and Test-Driven Development (TDD)
The Importance of Testing in Software Development
Agile Methodologies and TDD
Testing vs. Debugging
Levels of Testing (Unit, Integration, System)
Overview of Unit Testing: Concepts and Benefits
TDD: Red-Green-Refactor Cycle
TDD Principles: Write Tests First, Keep it Simple
Unit Testing with JUnit and Test Doubles
JUnit 5 Fundamentals:
Test cases, test suites, and fixtures (@BeforeEach, @AfterEach, @BeforeAll, @AfterAll)
Assertions (assertEquals, assertTrue, assertFalse, assertThrows, etc.)
Organizing tests with @Nested
Tagging and filtering tests
Writing Effective Unit Tests:
What to test: Focusing on behavior, not implementation
Test Isolation: Avoiding dependencies and side effects
Testing for exceptions
Test doubles:
Mocks, stubs, and spies
Using a mocking framework (e.g., Mockito)
Refactoring for Testability
Refactoring Java Code:
What, when, and why to refactor
Identifying code smells (e.g., Long Method, Large Class, Duplicated Code)
Refactoring techniques for testability (e.g., Extract Method, Extract Interface, Replace Conditional with Polymorphism)
Working with Legacy Code:
Strategies for testing code without tests
Characterization tests
Dealing with dependencies
Dependency Injection:
Understanding DI principles
Manual dependency injection
Using a DI framework (e.g., Spring DI, Guice) - Introduction only, full DI is a separate course
Advanced Testing Concepts
Test Coverage:
Measuring test effectiveness (e.g., line coverage, branch coverage)
Tools for measuring coverage (e.g., JaCoCo)
The importance of aiming for high coverage
Design Patterns for Testability
Testing Asynchronous Code
Testing with Lambdas and Streams
Continuous Integration and Build Automation
Automating Tests:
Benefits of automated testing
Integrating tests into the build process
Continuous Integration (CI):
Introduction to CI concepts and benefits
Setting up a CI pipeline
Jenkins CI:
Introduction to Jenkins
Creating and configuring Jenkins jobs/pipelines
Integrating with version control systems (e.g., Git)
Running tests in Jenkins
Build Automation Tools:
Maven: Project Object Model (POM), dependencies, and plugins
Gradle: Build scripts, dependencies, and tasks
Version Control Best Practices:
Using Git for source code management
Branching strategies (e.g., Gitflow)
Code reviews and pull requests
Test-Driven Development in Practice
Applying TDD to different types of applications (e.g., web applications, APIs)
TDD and database interactions (using test doubles or in-memory databases)
TDD and UI development
Common TDD anti-patterns and how to avoid them
Real-world TDD examples and case studies
-
JUnit 5 User Guide: https://junit.org/junit5/docs/current/user-guide/index.html - The official documentation for JUnit 5.
Mockito Documentation: https://site.mockito.org/ - The official documentation for Mockito, a popular mocking framework for Java.
Apache Maven: https://maven.apache.org/ - The website for Apache Maven, a build automation tool.
Gradle: https://gradle.org/ - The website for Gradle, a modern build automation tool.
Jenkins: https://www.jenkins.io/ - The website for Jenkins, a popular continuous integration server.
Trusted by