To whom it may concern:
We’re running static code analysis on two salesforce projects (apex code) through Azure pipelines. Sonar Cube publishes the code coverage results as being 47% for one project, and 50% for the other.
Salesforce has a quality gate which states that “unit tests must cover at least 75% of your Apex code” for code to be published. Obviously we’re intrigued.
Analyzing the resulting
test-result-codecoverage.json file and calculating the code coverage (using 100 values for nulls), we get an average of 84% for the both projects.
Can you please assist in getting this right? Thank you!
- ALM used:
- CI system used:
- Command used for obtaining code coverage:
sfdx force:apex:test:run -c -r json -l RunLocalTests -w 60 -d $(test-result-localFolder) -u $(CodeCoverageUser)
- Advanced->Addditional Properties passed to “Prepare analysis on SonarCloud” task:
- Error observed
Different code coverage result
- Steps to reproduce
In our case this happens with both our salesforce projects