0

can I get apex class in salesforce without test classes. Do we have any query ?

1 Answer 1

2

This SOSL query should find what you're looking for.

FIND
{class and not istest and not testmethod}
IN ALL FIELDS
RETURNING
ApexClass(Id, Name)
5
  • thanks @sfdcfox...but its not showing classes that comes through managed packages.
    – oookkk
    Commented Jan 5, 2017 at 7:13
  • 1
    @oookkk I'd expect not. You can't see their source code through queries. Not sure if there's a solution to that, honestly.
    – sfdcfox
    Commented Jan 5, 2017 at 7:38
  • @oookkk This is the sort of thing you should probably include in your original question, along with why you'd care to know this. This answer is clearly not what you're looking for, but I don't know how to help you.
    – sfdcfox
    Commented Jan 5, 2017 at 7:40
  • hi...How can we find test classes through SOSL ..? I have tried in workbench , it is working fine but in apex classes its showing error ...this is my query FIND { @istest and @testmethod} IN ALL FIELDS RETURNING ApexClass(Id, Name)
    – oookkk
    Commented Jan 12, 2017 at 9:01
  • @oookkk Just "find {@istest} in all fields returning apexclass(id,name)" will suffice for all modern unit tests. If you're also concerned about older unit tests, search for {@istest or testmethod} instead.
    – sfdcfox
    Commented Jan 12, 2017 at 11:21

Not the answer you're looking for? Browse other questions tagged .