Resilient

Resilient solutions can withstand disruptions and quickly recover from outages or failures. They are designed to be fault-tolerant and can maintain functionality even under adverse conditions.

Anti-patterns

Untested Apex method

Unit tests ensure that all code meets quality standards before it's deployed. Testing all your code is essential not only to meet Salesforce test coverage requirements but, more importantly, to make sure your logic keeps working as expected as your application evolves.
View anti-pattern

Missing data factory in test methods

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.
View anti-pattern

Insufficient number of assertions

An assertion is a statement that enables you to test your assumptions about your logic. Test methods should use assertions to ensure logic works as expected.
View anti-pattern

Missing annotation @IsTest in test methods

Salesforce has deprecated the use of the testMethod keyword. Annotating test methods with @IsTest is the widely recommended approach.
View anti-pattern

Test methods with full data access

As a best practice, tests should be isolated from the application database and create their own data. Access to the org data for unit tests, using the annotation @IsTest(seeAllData=true), should be avoided, as it makes test dependant on the environment on which they are executed.
View anti-pattern

Untested Lightning Web Components

Jest is a powerful tool for writing JavaScript tests. Developers should use Jest to write unit tests for their Lightning web components. Jest allows testing components in isolation, essential user interaction, verifying the DOM output and verifying that events fire when expected.
View anti-pattern

Dummy unit test

Salesforce requires a minimum of 75% test coverage before deploying code to a production environment. This safeguard protects customers and helps keep their applications resilient. Some developers use workarounds to artificially boost test coverage and circumvent this requirement by introducing dummy code and test routines. This approach is highly detrimental to quality.
View anti-pattern