10

I ran the test classes from developer console but it didnt not show me the lines which are covered. Whenever we run the test classes in developer console it highlights the the lines which are covered and which are not covered in different colors. I cleared test data,Compiled all classes and then again ran test classes but it didnt work. In Code Coverage menu i am just getting one option that is 'None'. Please suggest..

  • I believe sometimes it has glitches. You can try using mavenmate's plugin for sublime to run tests there, looks like mavenmate's test execution always shows coverage correctly – Patlatus Aug 18 '15 at 13:29
  • @Patlatus could you provide steps or may be help link of how to use it? Is it for IDE .. Thanks – Priyanka Gaikwad Aug 18 '15 at 13:31
  • Download and install MavensMate, then from within Sublime Text click MavensMate > Unit Testing > Show Apex Code Coverage For This Apex Class – Rob Aug 18 '15 at 13:38
  • Force.com IDE for Eclipse - run all tests will also give you code coverage – cropredy Aug 18 '15 at 16:36
  • 2
    In case someone ends up here after Winter 16 upgrade - with Winter 16, there is a known issue that means you need to run the tests with the new "always run tests asynchronously" checkbox set to true in order to see code coverage... – BritishBoyinDC Oct 19 '15 at 15:34
15

Go to the 'Apex Test Execution'and in option select list deselect the 'Store Only Aggregated Code Coverage' checkbox. enter image description here

6

It appears that in latest Winter 2016 upgrade a bug was introduced where code coverage line highlights are missing from the Salesforce Developer Console

salesforce-code-coverage-highlight-missing-fix

You can get them back by selecting the 'Test > Always Run Asynchronously' checkbox and re-running your test.

0

Make sure that your test class is covering the targeted class for which you have written the unit test methods.

none in top left dropdown is only displayed if there is no test method associated with the class which you have opened in dev console.

enter image description here

  • i ran the same test methods in eclipse, it was covering that class. – Priyanka Gaikwad Aug 19 '15 at 5:21
0

For my case, for it to calculate, I had to launch the test class via build > Develop >Apex Test Execution. Then from the same screen, click on the developer console button.

0

The following solved the problem for me I hope it helps you as well:

  • Try to create a test suits in eclipse by going to: File > New > Apex Test Suite
  • The "Create New Apex Test Suite" pop-up window should open up
  • Now select the project you are working on
  • In the text input box that is labeled "Apex Test Suite Properties", insert an arbitrary name for your test suite
  • Click on Next and from the list of classes, select all the test classes that you need to run together (it can be just one class)
  • Click Finish
  • Now from "Run" menu select "Run Configurations" and the window will pop up
  • You should see three tabs called "Project", "Test", and "Common", select "Test"
  • now in the Test tab under "Select one or more test suites" section click on "Use suite" checkbox
  • you should see the name of the test suite you just created (there might be other test suites there)
  • click on the checkbox next to the name of the test suite that you created and want to run
  • Finnaly click on "Apply" then click on "Run", and it will run the test suite and now you should see the test coverage and results in the "Apex Test Results" tab (I'm assuming you already know how to access this tab)

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.