I am being asked to use Jenkins to test code coverage for a Java Project. The issue is I have never used Jenkins and have scarcely little experience with actual code coverage. I have been searching a bit and I have come across JaCoCo and Cobertura as plugs. The issue is everything talking about them is above my head at this point. My question is this, as I understand it Jenkins and JaCoCo/Cobertura are used to run tests(Junit?), and report on how well the handle my code, but where do they get the test? Obviously I should make them, but what kind of files are these(again Junit?) and how do the tools get them?
If you are feeling generous, are there any good introduction level tutorials for these tools?
2:On the Jenkins dashboard, click on “Project Configuration,” scroll down, and click on the “Post-build Actions” from the drop-down options presented to you, click on the “Publish RKTracer Report.” If you have automated the process, the code coverage report will automatically get published on the Jenkins dashboard.
The easiest way to exclude code from code coverage analysis is to use ExcludeFromCodeCoverage attribute. This attribute tells tooling that class or some of its members are not planned to be covered with tests. EditFormModel class shown above can be left out from code coverage by simply adding the attribute.
To calculate the code coverage percentage, simply use the following formula: Code Coverage Percentage = (Number of lines of code executed by a testing algorithm/Total number of lines of code in a system component) * 100.
Maybe try looking in this direction:
Sonar:
There are lot of tutorials how to use Jenkins+Sonar so I guess you will not have much trouble. Sonar is really powerful tool, one of the best I've seen so far. And there is a plugin for Jenkins (but it can be avoided with certain profile in your maven project's pom.xml file).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With