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
Sachin30Sachin30 

test coverage is being calculated incorrectly

Strange behavior while calculating code coverage:

if I mention method call with parameters in different lines, salesforce consider it as different lines while calculating code coverage e.g
myMethod(p1,
p2,
p3,
p4);
Test coverage consider it as 4 lines. Instead it should be only one line as it is nothing but representation of one method call.
myMethod(p1,p2,p3,p4);
This makes the code writing highly inefficient as unwrapped long lines in editor are very difficult to manage for a developer. 
 
AnudeepAnudeep (Salesforce Developers) 
Apex testing framework considers it as 4 lines and that is working as designed

This is the reason we check classes for testing anti-patterns or redundant code that are oriented to increase code coverage without being valid functional tests. Examples of anti patterns are classes with a considerable number of characters and which just declare dummy variables and assign them dummy values:
Integer i1;
i1 = 1;
...
Integer i1000;
i1000 = 1;

Earlier, the Overall Code Coverage calculation used to count every line of untested class code, including the likes of debug lines, blank lines and comments. However, this has been fixed 

http://https://trailblazer.salesforce.com/issues_view?id=a1p30000000T1m1AAC&title=calculating-number-of-rows-incorrectly-for-classes-with-no-code-coverage

Let me know if it helps
covore7855 covore7855covore7855 covore7855
World Live News (https://www.worldlive.news/) Today's Top International News Headlines, news on politics, Business, Crime, Sports and Current World News: Get Latest and breaking information from World.