Unit Testing
The Arrange, Act and Assert (AAA) Pattern
The AAA (Arrange-Act-Assert) pattern has become almost a standard across the industry. It suggests that you should divide your test method into three sections: arrange, act and assert. Each one of them only responsible for the part in which they are named after.
Test Method Naming
Use the following test method naming methodName_stateUnderTest_expectedBehavior
Test Coverage vs Code Coverage
Focus on testing the code functions correctly rather than getting greater than 75% coverage
Test Data Factories
Create a TestDataFactory
class per object, and insert
the object and return the Id
By having a single TestDataFactory
per object, we avoid very large general classes which caused issues when merging.
Last updated