Replies: 3 comments
-
@TheZoker - I faced similar work trying to get Salesforce test runs and deployments coverage reports into SonarQube via our CI pipeline. I had to make a CLI plugin to accomplish this - https://github.com/mcarvin8/apex-code-coverage-transformer This handles coverage formatting and adjusting apex class file paths to the ones in your git repo, assuming you are using a git repo to deploy your metadata. It also "corrects" a bug with deployment coverage reports that hopefully will be fixed by the Salesforce API shortly (not affecting reports created by "sf apex test run/get"). I'd imagine if the standard coverage reports provided by the Salesforce CLI directly aren't sufficient for Bamboo, you might need to use a plugin or alternative solution. I could always look into supporting this coverage format in my plugin if you can provide a coverage file example. |
Beta Was this translation helpful? Give feedback.
-
@TheZoker - Thank you for submitting this idea. We plan to look broadly at improving Apex test output in the next 3-6 months. I've noted your request and will incorporate it into the public discussion that will be part of our design process. In the meantime, big thanks to @mcarvin8 for his work making plugins that help address issues like this! |
Beta Was this translation helpful? Give feedback.
-
If you want to try my plugin's clover output with Bamboo, please install v2.4.1 and test it out to confirm the "clover" format is accepted by Bamboo.
You will need to use the "json" coverage-formatter directly from the Salesforce CLI deploy or test command. My plugin converts the "json" coverage from the Salesforce CLI into 3 possible output XML formats: "sonar" (SonarQube), "cobertura", and now "clover". I've tested and confirmed the 1st 2, but would need help testing clover as I don't have Bamboo access. The "clover" format created by my plugin is identical to the "clover" format from the Salesforce CLI deploy command, but with correct repo file-paths and deployed covered line adjustment. Salesforce's native Clover coverage XML was version 3.2.0, so my plugin keeps that version of Clover. Either
Run my plugin to convert the Salesforce CLI coverage JSON into "clover" format.
See https://github.com/mcarvin8/apex-code-coverage-transformer?tab=readme-ov-file#apex-code-coverage-transformer for more information. EDIT: please use my plugin version 2.4.1. There's a bug with 2.4.0 clover reports on deploy command reports that is fixed by 2.4.1. |
Beta Was this translation helpful? Give feedback.
-
Hi there,
We want to use the result of the
sf apex get test --test-run-id $TEST_RUN_ID --result-format junit -d test-reports --code-coverage
command to show code coverage on every bamboo run. We found that there is a OpenClover code coverage tool for bamboo:https://confluence.atlassian.com/bamboo/viewing-the-clover-code-coverage-for-a-build-289276968.html
Now the question is, how do we get the salesforce testcoverage file into the open clover format.
Did anyone setup something similar before and can help us implement this in our CI/CD pipeline?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions