Hi, I’ve configured my Azure DevOps Pipeline to upload test-result-coverage.json to SonarCloud but I’m not able to see its results or even mention of it in the logs that it was uploaded. Please help.
Below are my configurations.
This generates the test-result-coverage.json
sfdx force:apex:test:run -c -r json -l RunLocalTests -w 60 -d ./testoutput -u $Alias
Hi @alexkoz Please check the directory you have mentioned, if you are generating the code coverage at runtime then the report will be generated at location $(Build.SourcesDirectory)\testoutput\test-result-codecoverage.json
Guys, thanks for your reply. Aanvekar was right about the file location.
I confirmed and the results are now showing. However, the overall results between SonarCloud and Salesforce are a bit off. SonarCloud is reporting overall coverage at 7.8%, while Salesforce is showing 9%. It’s close enough but wondering what the difference is?
Great @alexkoz SonarQube analysis the report and displays the aggregate result on UI.
Probably there are few other files which are getting counted as part of Code-Coverage, you can make use of “sonar.coverage.exclusions” to exclude those files.
@alexkoz when are you generating the code coverage report?
Using this above command we can generate only when the code is in ORG, is there any option to generate the code coverage before deploying the code? because I would like to add an Quality gate on code-coverage(CC) like if CC is less than 75% I want the build to fail or no deployment happens.
Is there are way to generate the code coverage before deployment ?
Also @mickaelcaro@janos, please add to it and let me know if there is any possibility.