I was going through the Tooling API guide and did some research on this but don't think there is a direct way to get the list of test classes in an ORG
ApexCodeCoverage which represents code coverage test results for an Apex class or trigger does have a ApexTestClassId field but not sure if it can give the complete list if you run the query: http://www.salesforce.com/us/developer/docs/api_toolingpre/api_tooling.pdf
I wanted to come back to this subject, because I faced problem like that few days ago, solution with querying by class name when class name contains 'test' wasn't satisfying for me, because what if some class has name 'TestUtil' and it's not a test class. I found solution, you can use tooling API and query ApexClass object like that:
On the picture I marked which property says that this is a test class, in non test class annotations list is empty. So all of information about classes you can find in SymbolTable object.
Hi, you can fetch all the classes and their code coverage from any org and to extract the test classes there is not any direct way, instead you need to check from its name. PFB link http://technome2.blogspot.in/2017/04/sample.html
ApexCodeCoverage which represents code coverage test results for an Apex class or trigger does have a ApexTestClassId field but not sure if it can give the complete list if you run the query:
http://www.salesforce.com/us/developer/docs/api_toolingpre/api_tooling.pdf
As all the test classes would be created starting/ending with "Test", you can query all test classes from ApexClass object by filtering on the name field. For details about the fields, please refer this link:
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_apexclass.htm
On the picture I marked which property says that this is a test class, in non test class annotations list is empty. So all of information about classes you can find in SymbolTable object.
you can fetch all the classes and their code coverage from any org and to extract the test classes there is not any direct way, instead you need to check from its name. PFB link
http://technome2.blogspot.in/2017/04/sample.html