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
Sudhakar ReddySudhakar Reddy 

Regarding code coverage calculations

Hi All,

 

 

 Can any one please explain me how to calculate code coverage  calculations in Apex

a!a!

Hi,

average code coverage(for all the apex classes and triggers) should maintain 75%.

Prady01Prady01

The code coverage is callculated like this 

 

(Total number of lines covered in the test class/ Total number of lines in apex class)*100 = some percent%

 

Hope it helps!!

Sudhakar ReddySudhakar Reddy

Thanks for giving reply.

 

 Do we need to calculate manually or through programming?

 

 Can you please post sample example how you have calcuated?So that I will be very clear.

goabhigogoabhigo

Hi Sudhakar,

 

There are plenty of blogs, articles on this. Here is one:

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

 

Go through it and you will have clear idea. If you still need a sample class and test class for it let me know.

Jerun JoseJerun Jose
When you do a run all test for your org, the test results will show you the overall code coverage for your organisation.