5

I want to run all unit tests on my org and download the code coverage report. The best for me is editable excel format. Is it somehow possible? Do you know any useful tools for apex unit tests to generate the report with classes code coverage?

8

You can use the ApexCodeCoverageAggregate object available in the Tooling API to obtain coverage information. However, this is not going to come down in an excel format. You can request this data in JSON or XML though, both of which are very easy to work with and can easily be converted to a CSV via an online tool or programmatically using a node, python, etc. library.

| improve this answer | |
3

There are paid services (e.g. GearSet or AutoRABIT) that include the ability to run tests on a schedule and output the results. There are free things you can do if you want to roll your own, such as using Jenkins or Heroku to run a Tooling/Metadata API call on a schedule to do the same thing, but you need your own parsing/conversion tools.

You can also use Apex Code to generate this report, which I've written something like that in the past. The point is, there's a way to run the tests on a schedule, and there's an API to get the data in a format that can be parsed. It's really a matter of doing some research to find a solution that works for you.

As always, do your research before settling for a specific product. There's a lot to choose from, so find one that meets your required features and budget requirements. Also keep in mind that "free" typically means you're left supporting the process internally, so be prepared to do so if you choose that route.

| improve this answer | |
0

If you want to set up your own system for running test classes, there are instructions here: https://securityzen.net/continuous-integration

You would have to expand on this to get the code coverage.

| improve this answer | |
-1

Code Climate is a tool that automates code review for test coverage, maintainability and more so that you can save time. It provides real-time feedback of your code to help maintain good code as you go. It also provides test coverage line by line, integrated with your github repo, run analysis locally and team management with permission visibility.

Full disclosure: I work for Panaya.com. This answer is part of a blog post we recently published on code review processes and tools for Apex code changes. The full blog post has more recommendations.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.