---
schema_version: "1"
id: 0e5dffc76e86e3b27a9c3de712a5169e4eb9d09af1162667e9078fe5efd8bf6c
title: "ApexGuru Test Case Antipattern: Using the testMethod Keyword"
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/apexguru_test_case_antipattern_using_testmethod.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.apexguru_test_case_antipattern_using_testmethod.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 0900fadc002dac81f8bef8dc87fe8f067138e9095610f201d26d6f38c43fee60
description: The testMethod syntax is outdated. Avoid using it to preserve confidence in your test suite and deployment quality.
products:
  - Cross Cloud
release: "264"
---
# ApexGuru Test Case Antipattern: Using the testMethod Keyword

The testMethod syntax is outdated. Avoid using it to preserve confidence in your test suite and deployment quality.

## Scope

Detection and recommendation

## Detection Example

```java
public class MyTestClass {
   static testMethod void myTest() {
      System.debug('This test will be versioned out soon as it has testMethod keyword');
   }
}
```

## Recommendation

Always annotate test classes with `@isTest`. Avoid legacy syntax. Adopt modern standards that properly recognize and execute all test methods.

```java
@isTest
private class MyTestClass {
   @isTest
   static void myTest() {
      System.debug('This test follows Salesforce recommended practices');
   }
}
```