+ Start a Discussion
Simon234Simon234 

No Run Test button in unit test

I have a test class, but it's without Run Test button. And Coverage is 0%. What kind of problem can it be?
Ajay K DubediAjay K Dubedi
Hi Simon,
I think you missed the test annotation. Just write @isTest at the top of your test class.
@isTest
Kindly mark it best answer if it resolves your issue.

Thank you,
Ajay Dubedi
Raj VakatiRaj Vakati
In order to mark the test class  you need to use @isTest annotation 

Use the @isTest annotation to define classes and methods that only contain code used for testing your application. The@isTest annotation on methods is equivalent to the testMethod keyword. The @isTest annotation can take multiple modifiers within parentheses and separated by blanks.


Here is an example of a private test class that contains two test methods.
 
@isTest
private class MyTestClass {

   // Methods for testing
   @isTest static void test1() {
      // Implement test code
   }

   @isTest static void test2() {
      // Implement test code
   }

}


https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_isTest.htm​