This course explores how to improve code test coverage and foster a more testable codebase. Increasing code test coverage is essential for ensuring confidence in modifying existing systems. It allows developers to make changes with minimal risk of introducing bugs, by providing a safety net of tests that document existing and desired behaviors.
Overview
Syllabus
- Unit 1: What Will be Covered in This Course Path
- Order Processing with Unit Testing
- Unit 2: Why We Want to Increase Code Test Coverage
- Adding the First Test to the Order Processor
- Add New Test For Multiple Different Items
- Adding a Test for Zero Order Items
- Ensuring Orders Have Correct Processing Date Set
- Unit 3: Increasing Code Test Coverage by Adding Characterization Tests
- Adding a Test Confirming Order Item Quantity Limit
- Test Demonstrating Discound Behavior
- Documenting the Shipping Method Determination
- Order Processing Uses Express Shipping for High Quantities
- Shipping Rules Make Perfect Sense
- Order Processing Edge Case Test
- Unit 4: Increasing Testability - Adding Interfaces and Mocks
- Email Service Dependency Done Right
- Email Service Implementing Interface
- Exchange Concrete Email Service for an Abstraction
- Mock Dependencies in Order Processing
- Adding Tests That Utilize Mocks
- Unit 5: Bringing Writing Tests and Mocks Together
- Creating a Database Abstraction
- Using the Abstraction as a Dependency
- Setting Up Test Environment Basics
- User Login Test
- Mock Database User Login Tests
- Database Exception Testing Made Simple