No, you cannot pull the code coverage via a SOQL Query.
If you need to access the metadata layer of the platform you can use the Force.com Metadata API - http://www.salesforce.com/us/developer/docs/api_meta/.
With the metadata api you can do things like query the objects, execute unit tests, etc.
I don't know if you can query with SOQL, but you can use SOAP or Rest to get the information. Check out the Tooling API dev guide: http://www.salesforce.com/us/developer/docs/api_toolingpre/api_tooling.pdf
It gives this SOQL example:
SELECT Coverage FROM CodeCoverage WHERE ApexClassOrTrigger = ‘01pD000000066GR’ AND ApexTestClass = ‘01pD000000064pu’
but I could make this work in Dev Console, so I don't know if it will work in other Apex code.
1) Go to www.aside.io 2) Login with your Sandbox/Production credentials and allow requirements 3) Click "data" on top right (just above your username). 4) Write SOQL Query over there (For ex : SELECT ApexClassOrTrigger.Name, NumLinesCovered, NumLinesUncovered FROM ApexCodeCoverageAggregate ORDER BY ApexClassOrTrigger.Name ASC) and click "query" button on left top tabs. 5) You will find the results, and the results can be exported by clicking "export" button on left top tabs.
If you need to access the metadata layer of the platform you can use the Force.com Metadata API - http://www.salesforce.com/us/developer/docs/api_meta/.
With the metadata api you can do things like query the objects, execute unit tests, etc.
http://www.salesforce.com/us/developer/docs/api_toolingpre/api_tooling.pdf
It gives this SOQL example:
SELECT Coverage
FROM CodeCoverage
WHERE ApexClassOrTrigger = ‘01pD000000066GR’
AND ApexTestClass = ‘01pD000000064pu’
but I could make this work in Dev Console, so I don't know if it will work in other Apex code.
-Glyn
Regards,
Satish Kumar
1) Go to www.aside.io
2) Login with your Sandbox/Production credentials and allow requirements
3) Click "data" on top right (just above your username).
4) Write SOQL Query over there (For ex : SELECT ApexClassOrTrigger.Name, NumLinesCovered, NumLinesUncovered FROM ApexCodeCoverageAggregate ORDER BY ApexClassOrTrigger.Name ASC) and click "query" button on left top tabs.
5) You will find the results, and the results can be exported by clicking "export" button on left top tabs.
Let me know if you have any questions.
Thanks,
Jyothieswar.
We can write test code for SOQL???