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
Shivendu Pande1Shivendu Pande1 

Why code coverage result is different when we run it from CLI and Salesforce

We are working on SonarQube code coverage, We are using Salesforce CLI for generating the code coverage result and we are importing that result in the SonarQube.

We see that there is a difference in Result that we see on Salesforce UI and JSON file

Salesforce UI shows 85% & SonarQube shows 55%

We followed the Link https://help.salesforce.com/articleView?id=000335222&type=1&mode=1 and cleared the history but still, we are facing the issue.

please suggest if anyone came across the same issue
 
VinayVinay (Salesforce Developers) 
Hi Shivendu,

Can you try to check the individual component i.e apex class or trigger and test class?

Also, re-run the test class in salesforce UI and check the latest coverage.

If its 85% then can you try to validate single components and check behavior.

Thanks,
Vinay Kumar