Hi everyone , In this article we will discuss how to get list of all apex classes code coverage from SOQL query? This post will help you to ease your work and at the end you will be handy with excel where all the classes will be listed along with their code coverage. I am going to provide you the SOQL query as well as the simplest way to transfer all records to excel sheet.
Once the execution of test classes from “Run All tests” is completed. Below is the SOQL query we are going to use for our requirement which will give us all the apex classes/triggers , number of lines covered and number of lines uncovered.
Note – Use Tooling API must be checked to run the below query.
SELECT ApexClassOrTrigger.Name, NumLinesCovered, NumLinesUncovered FROM ApexCodeCoverageAggregate ORDER BY ApexClassOrTrigger.Name ASC
Now we will transfer all the records and put into the excel and just apply a formula to get the exact percentages of all classes.
Excel help us to get all the list of apex classes along with their code coverage in the org. This technique will definitely expedite in achieving our expected result and seems not tedious as well.
I hope you find this post useful! Catch you in the next content.
And thank you for being an awesome reader.
Share and grow together !!
If you have any doubts you can comment down below, I will try to reply ASAP.
Also keep visiting us, for more such content!