Assertions with comments

Use this rule to ensure all assertions include explanatory comments.

Lorenzo Frattini avatar
Written by Lorenzo Frattini
Updated over a week ago

Rationale

As a best practice, all assertions should include a comment to describe the rationale or the expected outcome.

Scope

  • Apex methods annotated with @isTest

  • Apex methods with the testMethod modifier

Exclusions

  • This rule will not fire for assertion-equivalent methods performed using third party libraries, such as fflib_ApexMocks

Did this answer your question?