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?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityYou can get it in a pinch using the Code Coverage dropdown from an open class:
If he's hiding... just takes a few steps after launching Developer Console:
File > Open > Apex Class and select one with @isTest annotation
hit Run Test on the top right
go to the Tests tab, expand your test class and double click on your test run item:
this exposes the Overall Code Coverage pane; now double click the name of your relevant class,
see the test coverage now highlighted over the top of your code.
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.
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.
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
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.
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.
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.
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.
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 @mattandneil answer to see the highlighted classes.