+ Start a Discussion
PriyadarsanPriyadarsan 

How to get Code Coverage through Apex Code

Can anyone suggest me how can I get code coverage through Apex code ?

 

My requirement is to email top 10 classes/triggers with lowest amount of code coverage everyday.

Andy BoettcherAndy Boettcher

It looks like you will be able to do this via the Web Services API - but it appears to be in BETA at this time...

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_testing_unit_tests_running.htm

 

Look at the last section on the bottom titled "Running Tests Using the API"

 

-Andy

gm_sfdc_powerdegm_sfdc_powerde

The ability to run tests and get the results with code coverage info has been a part of the API for a long time. - http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/sforce_api_calls_runtests.htm

 

 

You will have to download the Apex WSDL for this.    To the poster's original question, I am afraid it's not possible directly via Apex.