Writing True Unit Tests Using Dependency Injection and Mocking

preview_player
Показать описание
Writing robust unit tests can be tricky but can be helped greatly by applying patterns of dependency injection and inversion of control. Come learn what DI and IoC are, and how they can be applied in several patterns for testing in Apex.
Рекомендации по теме
Комментарии
Автор

I think his definition of a unit test is wrong. A unit is a unit of behaviour, not the smallest possible thing that you can test.

If you try and test too small, you are testing implementation, rather than behaviour. This will result in a brittle test suite that will get in the way of refactoring and slow down productivity.

Instead you should test for behaviour, so that the implementation can be changed and improved later.

chrispaul