Apex Unit Test Method Should Have "@IsTest" Annotation

Impact area

Manageability

Severity

Medium

Affected element

Apex Class

Rule ID

SF-IS-TEST

Impact

Apex test methods should have @isTest annotation instead of the testMethod keyword, as testMethod is deprecated. Salesforce advices to use @isTest annotation for test classes and methods.

Remediation

Replace testMethod keyword with isTest.

Time to fix

10 min

References

This rule is linked to ApexUnitTestMethodShouldHaveIsTestAnnotation

What's here


Related content

Apex Page rules

Salesforce rules




Last modified on Sep 20, 2023