---
title: "Apex Unit Test Method Should Have “@IsTest” Annotation"
description: "**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…"
url: "https://community-staging.qualityclouds.com/qcdocs/qc/pmd-rules/apex-unit-test-method-should-have-istest-annotation/"
updated: "2025-03-21"
category: PMD Rules
---

# 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](https://pmd.github.io/pmd/pmd_rules_apex_bestpractices.html#apexunittestmethodshouldhaveistestannotation)
