Explore the critical role of test doubles in modern software testing. This session introduces you to dummies, stubs, spies, mocks, and fakes. Gain expertise in isolating units under test, managing behavior, and constructing fast, reliable, maintainable tests. Step into using test doubles to enhance your development practices.
Overview
Syllabus
- Unit 1: Introduction to Dependencies in Testing with Ruby
- Testing Email Parameters with Dummies
- Enhancing DummyLogger with Severity Parameter in EmailService
- Fixing Test Suite for EmailService with Test Doubles
- Enhancing EmailService Tests with Dummies
- Enhancing NewsletterService Tests with Dummies
- Unit 2: Using Stubs in Test Driven Development with Ruby
- Using Stubs to Simulate Weather Conditions in Ruby
- Using Stubs to Handle Temperature Alerts in Ruby
- Handling Storm Warnings in WeatherAlertService Using Stubs
- Handling Normal Weather Conditions in Weather Alert System Using Stubs
- Refactor Weather Alert Service Using RSpec Doubles
- Unit 3: Integrating Spies into TDD with Ruby and RSpec
- Verify Notification Send Method with RSpec Spies
- Verify Notification Delivery with RSpec Spies
- Testing Notification Priority with RSpec Spies
- Verify Notification Functionality with RSpec Spies
- Unit 4: Introduction to Mocks with Ruby and RSpec
- Testing Pricing Service with Mocked Exchange Rate Values
- Isolating Exchange Rate Calls in Pricing Service Test
- Testing Pricing Service with Negative Amount Exceptions
- Testing Pricing Service with Custom Exchange Rate Mocks
- Testing Pricing Service with Bulk Price Calculations
- Unit 5: Introduction to Fakes in TDD with Ruby and RSpec
- Implementing User Creation with Fake Repository Using Test-Driven Development
- Implementing Duplicate Email Validation during User Registration in TDD
- Implementing User Name Update with Test-Driven Development in Ruby
- Implementing Exception Handling for Non-Existent User Name Updates in TDD
- Implementing Deactivate User Method in TDD with Ruby
- Implementing Exception Handling for User Deactivation in TDD