Preface
About this Book
- Style Guide
- Example Code
- Errors and Omissions
- Feedback
- Part One - A Testing Primer
Introduction
- Software Testing
- The Impact of Generative AI
- Approaches to Testing
- Types of Testing
- Summary
Salesforce Test Framework
- Overview
- Apex Test Classes
- Annotations
- Identifying a Test Class
- Identifying Test Methods
- @IsTest Annotation Attributes
- Public versus Private Test Classes
- Test Data
- Test Data Setup
- Test Execution Demarcation
- Verification
- Masquerading as another User
- Exposing the Implementation
- Detecting Test Context
- Parallel versus Serial Test Execution
- Summary
Unit Testing
- Overview
- Benefits of Unit Testing
- Unit Tests are not Free
- Unit Tests are not a Silver Bullet
- Anatomy of a Unit Test
- Testing the Platform
- Test Doubles
- Techniques for Identifying Test Cases
- Summary
- Part Two - Testing Apex
Plain Old Apex Code
- Static Utility Methods
- Stateless Apex Class With Dependency
- Stateful Apex Class
- Summary
Platform Managed Apex Code
- Apex Triggers
- Asynchronous Apex Overview
- Future Methods
- Batch Apex
- Scheduled Apex
- Apex REST
- Summary
- Part Three - Executing Tests
- Before you Execute Tests
Executing Tests via the User Interface
- Setup Menu
- Developer Console
- Summary
Executing Tests via Salesforce Developer Tools
- The Salesforce Command Line Interface
- Visual Studio Code
- API
- Apex
- Summary
- Part Four - Integration Testing
Apex Integration Testing (Developer Preview)
- Overview
- Annotations
- Anatomy of an Integration Test
- Testing Field History Tracking
- Testing Agentforce
- Executing Integration Tests
- Integration Test Environment
- Summary
- Part Five - Advanced Testing
Mutation Testing
- Mutation Testing Overview
- The Mechanics of Mutation Testing
- Why Mutation Testing Works
- Mutation Testing in Practice
- When a mutant survives
- The Human Oracle Problem
- When to Apply Mutation Testing
- Summary
Property-Based Testing
- Overview
- The Mechanics of Property-Based Testing
- Property-Based Testing in Practice
- The Human Judgement Problem
- When to Apply Property-based Testing
- Summary
Differential Testing
- Overview
- Differential Testing in Practice
- The Reference Implementation Problem
- When to Apply Differential Testing
- Summary
Growth Testing, or Testing How Code Scales
- Overview
- Big O Notation
- Growth Testing in Practice
- When to Apply Growth Testing
- Summary