Test methods should not create record instances directly as they would break whenever adding validation rules. As a best practice, the creation of test data records should be centralised using test data factories or builders.
Business Impact
Prolonged downtime, slower recovery from failures, and impaired business continuity.
Is your Salesforce solution affected by Missing data factory in test methods?
Clayton detects anti-patterns and offers automated fix advice to kickstart your Well-Architected journey.