Apex Unit Test Method Should Have “@IsTest” Annotation

< 1 min read

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

Updated on March 21, 2025
Was it helpful ?