In previous blog post, we discussed best practices of writing Test classes in Apex. In old school way, if we wanted to create records for test methods, helper or utility classes were favorite option for developers.
However this approach has few disadvantages
- Multiple Test classes could depend on these utility methods
- It creates tight coupling between classes
- Deployment could be slow if unnecessary test record being created for test methods
- If class to create test record is not marked with @isTest then it will count against allowed apex code in instance
- Test classes needs to explicitly call method to create test records