Discover the pivotal role of test doubles in modern software testing. This introductory session will guide you through the essentials of dummies, stubs, spies, 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
- Testing Email Parameters with Dummies
- Enhancing the Logger Interface
- Fix the Test Suite Bug
- Implementing Dummies in Test Suites
- Master Dummies in Test Suites
- Unit 2: Isolating Dependencies with Test Doubles: Stubs
- Stubbing for Weather Alerts
- Handle freezing conditions with Stubbed data
- Handling stormy conditions
- Stubbing Out Lovely Weather
- Refactor!
- Unit 3: Utilizing Spies in Test Driven Development with Jest
- Spying on Method Calls
- Spying on Urgent Notifications
- Spying on Medium Priority Notifications
- Spying on Multiple Method Calls
- Unit 4: Mocking Dependencies with Jest in TDD
- Mock Pricing Service for Testing
- Verifying Dependencies Aren't Called using Mocks
- Expect Exceptions for Negative Prices
- Mocking Multiple Calls with Mock Implementations
- Calculating Bulk Prices
- Unit 5: Isolating Dependencies with Test Doubles: Fakes
- Using a Fake User Repository
- Expect an Exception When Adding Duplicate Users
- Update a Registered User
- Handle when Updating Non-Existent Users
- Deactivating Users
- Expect Exception when Deactivating Non-Existent Users