Help: Build Failure conditions doesn't fail the Build
Requirement:
Fail the build if the code coverage of the build is less than 80%
I added the failure conditions to fail build if the above criteria is met. I ran the build and the build succeeds even though the code coverage is < 80%. We have unit test as one of the build step mvn test -Pscala-code-coverage
and it produces the below coverage percentage.
[INFO] Found 1 subproject scoverage data directories.
[INFO] Generating coverage aggregated reports...
[INFO] Written Cobertura XML report [/home/tcagent/.buildAgent/work/93cb2a96017855db/target/cobertura.xml]
[INFO] Written XML coverage report [/home/tcagent/.buildAgent/work/93cb2a96017855db/target/scoverage.xml]
[INFO] Written HTML coverage report [/home/tcagent/.buildAgent/work/93cb2a96017855db/reports/index.html]
[INFO] Statement coverage.: 81.22%
[INFO] Branch coverage....: 78.72%
At the end of the build I get this message.
Cannot calculate build metric 'percentage of branch coverage' - no value
Cannot calculate build metric 'percentage of line coverage' - no value
I'm using scoverage for the code coverage.
The xml's are artifacted as part of the build using the below,
+:glue/target/cobertura.xml => cobertura.xml
+:glue/target/scoverage.xml => scoverage.xml
+:**/coverage/*/*.html => coverage.zip
+:**/findbugs/*/spotbugs.xml => findbug.zip
+:**/pmd/*/pmd.xml => pmd.zip
The scoverage.xml has these lines,<scoverage statement-count="740" statements-invoked="601" statement-rate="81.22" branch-rate="78.72" version="1.0" timestamp="1749704274569">
Please refer the attached screenshots.
Please sign in to leave a comment.