Loading
システム管理者に対するフィッシング耐性MFA・全従業員ユーザーMFAの適用のお知らせ 続きを読む
ただいま大変多くのお問い合わせをいただいており、ご連絡までにお時間を頂戴しております続きを読む
Scalability
ApexGuru Test Case Antipattern: Using the testMethod Keyword

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

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.

@isTest
private class MyTestClass {
   @isTest
   static void myTest() {
      System.debug('This test follows Salesforce recommended practices');
   }
}
 
読み込み中
Salesforce Help | Article