Discover the pivotal role of test doubles in modern software testing. This introductory session will guide you through the essentials of dummies, stubs, mocks, and fakes. Learn how these powerful tools help you isolate units under test, control behavior, and build reliable, fast, and maintainable tests. Step into the world of test doubles and elevate your software development skills.
Overview
Syllabus
- Unit 1: Isolating Dependencies with Test Doubles: Dummies
- Understanding EmailService in TDD with Dummy Implementations
- Enhancing Logger Interface with Severity Parameter
- Identifying and Fixing Bugs in EmailService Tests
- Implementing Dummy Dependencies in EmailService Tests
- Implementing Test Doubles for NewsletterService in C#
- Unit 2: Isolating Dependencies with Test Doubles: Stubs
- Stubbing for Weather Alerts
- Handle freezing conditions with Stubbed data
- Replace the hand-built Stub with Testify
- Handling stormy conditions
- Stubbing Out Lovely Weather
- Refactor!
- Unit 3: Mocking Dependencies with Testify in TDD
- Mock Pricing Service for Testing
- Verifying Dependencies Aren't Called using MocksMock Pricing Service for Testing
- Expect Errors for Negative Prices
- Mocking Multiple Calls with Mock Implementations
- Implement and Test Currency Price Conversion
- Unit 4: Isolating Dependencies with Test Doubles: Fakes
- Using a Fake User Repository
- Expect an Error When Adding Duplicate Users
- Update a Registered User
- Handle when Updating Non-Existent Users
- Deactivating Users
- Expect Exception when Deactivating Non-Existent UsersDeactivating Users