function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
saimadhusaimadhu 

code coverage in testcase

Hi,

My controller and page is executing fine.but when i write a testcase it covered only 66% and showing red mark on comments and spaces between lines.How to get rid off this.

 

HariDineshHariDinesh

Hi,

 

Go through below links which makes you understand about writing test methods.

http://wiki.developerforce.com/page/An_Introduction_to_Apex_Code_Test_Methods

http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_error_handling.htm

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_test.htm

 

If still you are having problem with coverage post the code (both main and test method) with uncovered lines highlighting,

Some persons from the board can help you.

SamuelDeRyckeSamuelDeRycke

Have you ran your test several times ? I've never had problems with comments showing up as not covered.  Are you sure all code is covered ? Often people new to writing apex test have trouble with conditional code, and test (run through) only one of the mulitple conditional branches that can be found in their code.