A quick question. We used to have a code coverage highlighted in dev console on which lines of the class are covered and not covered before.

Has salesforce removed this option or do i need to activate it somewhere?


You can get it in a pinch using the Code Coverage dropdown from an open class:

step 0

If he's hiding... just takes a few steps after launching Developer Console:

  1. File > Open > Apex Class and select one with @isTest annotation

  2. hit Run Test on the top right

    step A

  3. go to the Tests tab, expand your test class and double click on your test run item:

    step B

  4. this exposes the Overall Code Coverage pane; now double click the name of your relevant class,

    step C

  5. see the test coverage now highlighted over the top of your code.

| improve this answer | |
  • Gosh... i cant see it.. on double click i can see the class open but no highlight. Only option on the drop down on the test coverage panel is Code Coverage : None. – Prady Jan 13 '14 at 15:23
  • 1
    @Prady when was the last time you run any tests touching the class? – bigassforce Jan 13 '14 at 15:36
  • 3
    @user320: Actually the same thing happened today in my test org too. I was able to see the coverage to be 73% in the overall code coverage section, but was unable to view the covered lines, the dropdown just showed None as Prady is pointing out. I also ran the test class, the test class ran without any errors, but still no luck with the covered lines. – Sam Jan 13 '14 at 17:04
  • @user320 i have been running the test pretty much the whole day – Prady Jan 14 '14 at 4:15
  • This way it actually works, but not consistently(as reported by others). Looks like Salesforce issue. – Ganesh Bhosle Jan 14 '14 at 5:33

Goto setup -> Develop -> Apex Test Execution and click the Options button.

Make sure "Store Only Aggregated Code Coverage" is UNCHECKED

That fixed the issue for me.

| improve this answer | |
  • yep that was the culprit 1+ – Nick Kahn Sep 30 '15 at 17:07

Its still there, you need to run your tst and then in the bottom right, under the 'Overall Code Coverage' section, find your class and double click and then you have your color coding your looking for

enter image description here

| improve this answer | |
  • i see you have this option on your env.. but when i double click all i see is a class with no highlighter – Prady Jan 13 '14 at 15:26
  • 4
    this is very inconsistent, sometime I see coverage highlighted and sometimes I do not. what a pain. – Prafulla Patil Jan 13 '14 at 17:12

If the Code Coverage is appearing as none, try clearing the previous test results (ApexTestResult records) by visiting /07M?retURL=%2F07M&ClearAllData=1 (or Setup > App Setup > Develop > Apex Test Execution > View Test History > Clear Test Results) and then rerunning the tests.

The tests need to be run async (queued) to pick up code coverage results in the RunTestsResult.

The run tests should appear on the View Test History page (/07M). Then they can be used to find the code coverage results.

| improve this answer | |
  • 1
    unfortunately it still shows coverage:none after clearing history. When you say test needs to be run async do i need to disable parallel processing ? – Prady Jan 14 '14 at 4:41
  • 1
    @Prady Async is the default way test cases are run now in Salesforce. They are put in a queue and the processed from there. Via the API you can still run them syncrounsly. If you aren't using a third party tool to run the tests (potentially Eclipse) then you should be fine. – Daniel Ballinger Jan 14 '14 at 18:19

For me the Test Code Coverage only appears if I run the tests from Setup: Setup > Build > Develop > Apex Test Execution > Select Tests.. > (select your namespace and test classes) > Run

This way I get both the code highlight and coverage percentage in Developer Console immediately after the tests completes. On the other hand, if I run the tests directly from Developer Console I get non of those.

| improve this answer | |
  • 1
    None of the other suggestions worked but yours did !!!..thanks a lot – Rainmaker Feb 4 '16 at 4:47

OK one more thing to try, in the Debug Console, make sure the "Always Run Asynchrounously" checkbox is checked.

Before changing this setting, I was only able to see the code coverage if I ran from Apex Test Execution as mentioned in @smukov answer.

After changing that setting, when I click Run Test, the percentage is updated in the Overall Code Coverage panel and I can then follow @bigassforce answer to see the highlighted classes.

| improve this answer | |

I had the same issue, what fixed it for me was going to Salesforce Setup->Develop->Apex Test Execution->Options Button->make sure Disable Parallel Apex Testing is CHECKED. Apparently the Console can't collect the Code Coverage if the tests are running Asynchrounously.

| improve this answer | |

Try this Heroku app for it. It is very simple and easy to use.

Code Coverage Report Generator: The application provides the view of all code coverage from the organization and can generate excel sheet of all code coverage.


| 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.