Contents[Hide]

Developer console since Winter '13 got a new feature called "Tests" which is very usefull if you want to see which lines are covered and which not, it is colour codded.

Opening developer console

To access this functionality click on your name then "Developer Console", it will load in new window.

Then choose tab "Tests" (1), wait few seconds until "Overall Code Coverage" list (2) will be filled in with all your classes.
Double click on:
- your controller which will be checked for code coverage (example: my_customVisualforcePage_Controller)
- test for this controller (example: my_customVisualforcePage_Controller_Test)

those two classes will be displayed in the middle of a window with own tabs (4)


Developer Console Testing window

Running the test of single class

Now click button "Run Test" from section (6) to start testing this particular class.

It will add new job in top section with indicator that test is running, after successfully run you will see green mark there and test results will be updated.

Running the tests of multiple or all classes

It is also possible to run test of few chosen classes, click on "New Run" button (3), in "Select Test" window define which test you want to run and click "Run" button.

Use "Copy Run" button previously selecting previous run on a list to run the same set of tests.

You may run all test in your organization by clicking on "Run All" from section (3).
It will take more time to complete so I advise to run it after you finished with one class tests to validate it aginsts whole organization.

Reviewing results of tests

After successfully run go to controller tab and click on "Code Coverage" button.
You will see coverage for All test cases together and also for every single test case.

Select "All Tests" then see colour coded results. Blue is covered by the test red is not covered.


Test coverage results

Now you can edit Controller and Test class inside developer console, then press "Save".
"Run Test" button on Test class tab will re execute test again and update all results statistics.
 

Additional knowledge:
Diving Into the Developer Console (Webinar)
 

   
© Paweł Woźniak