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