2

I am looking for simple solution to find he class is a test class , Other than checking body contains @isTest ?

i have checked the below URL but there are no options ?

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_apexclass.htm

  • 1
    Why isn't just checking for '@isTest' the easiest way of doing it? – Dave Humm Feb 23 '17 at 10:15
2

You can use a SOSL query to find your test classes. Note that this is not foolproof, as SOSL doesn't differentiate between comments and non-comments

ApexClass[] unitTests = [FIND '@isTest' IN ALL FIELDS RETURNING ApexClass(Id, Name)][0];

How to get a list of Test Classes in an org

else, You can go to "Setup > Develop > Apex Test Execution". There you can press on the button "Select Tests...", this will list all the current test classes in your org.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.