Test-Driven Development in Java
Contact us for Onsite Price
Layout
The training course combines lectures with practical exercises that help the delegates to put what they have learned on the training course into practice. The exercises specifically build on what has been recently taught and are built up as the training course progresses.
Training Course Objectives
- Use the JUnit and mocking libraries to write tests
- Run tests from an IDE and from Maven/Gradle build scripts
- Apply patterns and practices for writing testable code
- Extend the scope of tests into analysis, design and documentation
- Use tests to communicate with the customer
Who it is for
This training course is aimed at Java developers and analysts, typically in the context of adopting agile development practices.
Training Course Prerequisites
- Delegates should have some appreciation for the issues involved in building large-scale applications. Delegates should also have a development background.
Chapters
Chapter 1 Introduction
- Why test-driven development?
- Is TDD necessary?
- TDD is about...
- red/green/refactor
Chapter 2 Getting Started
- Separating code from tests
- Package structures
- JUnit 4 basics
- Assertions
- JUnit setup/teardown
- Exceptions
Chapter 3 Writing Tests
- Base test classes
- Matchers
- Naming / Organization
- Implementation strategies
- Exploring APIs
- Parameterized test runners
Chapter 4 Writing
- Equals and value objects
- Seams and sensing
- Seam types
- Inheritance
- Singletons and Statics
- Dependency injection
Chapter 5 Test doubles
- Test double taxonomy
- Stubs
- Fakes
- Mocks
- Mocking Libraries such as Mockito and PowerMock
- Setting Expectations and Verifying Interactions
- Mocking Gotchas
- Testing Legacy Code
Chapter 6 Understanding the Code through Tests
- Showing the Call Hierarchy
- Generating Documentation from Tests
- Parsing the Test Source Code
- Transcripts
- Fluent Interfaces
Chapter 7 Organising Tests
- Test Suites
- Explicitly-built Test Suites
- Implicitly-built Test Suites
- Filtering and Sorting
- Ordering
Chapter 8 TDD in Context
- Relationship to Other Agile Practices
- Closing Discussion
Chapter 9 More on fixtures
- Making the Context Concrete
- One-time Setup for Classes
- One-time Setup for Suites
- Fixtures and Superclasses
- Object Mothers
- Fixtures as Objects
- Data-driven Fixtures
- Using Databases
- Testing Database Code
Chapter 10 Theories
- Tests vs Theories
- Triangulating Tests
- Parameter Suppliers
- Assumptions
Chapter 11 Tests as Specification
- The Trouble with TDD
- Behaviour Driven Design using Cucumber
- Customer Acceptance Testing using Cucumber and Selenium