-
Notifications
You must be signed in to change notification settings - Fork 11
Apex Test Mocking (In Progress)
Coding With The Force edited this page Dec 31, 2020
·
6 revisions
Notes:
- Can't test static methods at all
- Methods need to be very modularized as it's borderline impossible to do good mocking with mega methods.
- Service layer code should be tested for real (potentially using mocks for dependencies though) to make sure the user gets the expected results.
- Really only meant for Domain and Application layer tests
- Speeds up testing significantly
Easiest library to use IMO: https://github.com/surajp/universalmock
Also have good object data mocking classes here (originally built by Caleb Weaver): https://github.com/Coding-With-The-Force/SalesforceBestPractices/tree/master/MockDataBuilder