Is it possible to display Jacoco Coverage report on Jenkins dashboard? - jenkins

I have jenkins file which has publishHTML method to generate report with .html file of jacoco result. Is it possible to display that report on dashboard like 'Test Trend Result' ?

So I went through a bit then found a solution adding to the pipeline directly
publishCoverage adapters: [jacocoAdapter('target/site/jacoco/jacoco.xml')]
Reference: https://github.com/jenkinsci/code-coverage-api-plugin

You need to use the JaCoCo plugin
Get coverage data as part of your build First you need to get coverage
calculated as part of your build/tests, see the JaCoCo documentation
for details. You need at least one or more *.exec file available after
tests are executed. Usually this means adjusting your Maven pom.xml or
Ant build.xml file..
Set up coverage retrieval and publishing In order to get the coverage
data published to Jenkins, you need to add a JaCoCo publisher and
configure it so it will find all the necessary information. Use the
help provided via the question-mark links for more information.
Basically you specify where the *.exec files are, where compiled code
can be found and where the corresponding source code is located after
the build is finished to let the plugin gather all necessary pieces of
information..

Related

What version of Checkstyle is getting used in warnings next generation plugin 6.1.1 from jenkins?

I am trying to configure static code analysis on my jenkins server for maven project. I want to use google checks for Checkstyle based code analysis. To use appropriate google checks xml file I want to know the version of checkstyle used in warnings next generation plugin 6.1.1.
Can anyone please help me with this?
Warnings-ng plugin is not analyzing your code, it just creates visualization of checkstyle analysis results.
So you need to perform analysis by some other tool (e.g. maven) first and after than warnings-ng can show you results.

Where are consolidated TestNG reports present for publishing to CI?

target/surefire-reports/TEST*.xml, and
target/surefire-reports/junitreports/TEST*.xml
Above files only have the re-run tests from testng-failed.xml.
But I need complete test results to be published in Jenkins, the successful cases and failed cases, all.
Need a solution that does not needs code changes like implementing listeners etc.
You should find a testng-results.xml file somewhere in target/** which is what you are looking for.
It is recommended to use the TestNG Jenkins plugin too.

Is there a Jenkins code coverage plugin for Perl?

We have our software product which is written in perl. We have setup a Jenkins build for that which runs the automated tests, to get the coverage values we run the unit tests under Devel::Cover, and get the coverage values for each module. But I find it very difficult to go and check the coverge values for each module individually, also it doesn't tell us where are we heading as far as coverage is concerned (increasing/decreasing trend). So what I'd like is to have a history or graph of those values, so that I can have a better picture of where our coverage values are and how do they compare to, say a month ago.
Is there a plug-in available that would do this thing?
I searched the Internet and found some plugins like cobertura and emma that I hope would achieve that purpose, but they are for Java. Is there a good alternative for Perl?
Also, would it be worth it to develop our own tool to display such plots? We already have the coverage data in Jenkins, and all we need is just to get that data and plot it.
You can with luck use Devel::Cover's HTML output formatting, put by default in the cover_db directory by:
$ cover -test
The install and configure the HTML Publisher Plugin.
Configure it as so:
HTML directory: cover_db
index page: coverage.html
Report title: Coverage Report
I written up my notes for setting this up, and they are available at:
https://logiclab.jira.com/wiki/display/OPEN/Continuous+Integration#ContinuousIntegration-CoverageTests
I am currently looking into the Jenkins Plugin Clover, since Devel::Cover can also output in Clover format. I will update my notes soon.
You can with luck use my CPAN distribution Task::Jenkins, installing all of the CPAN dependencies needed for the setup on the referenced wiki page.

Combine cobertura code coverage reports of three separate projects

I have three projects which are stored in three separate repositories. Each of them is a individual mvn project. I wonder is there a way to aggregate three reports in one?
I took a look at the cobertura aggregate function. But seems like it can only handle sub-modules of a project.
Anybody has any suggestion?
The Maven plugin goal cobertura:cobertura supports an aggregate parameter that would work for all the projects in the reactor I suppose.
But you seem to suggest the projects might not be in the same structure/reactor, and i wouldn't know how to do it with maven per-se. However, you can easily do it with a little ant script that can be integrated in your maven structure.
The Cobertura Ant library has a merge task that can merge a number of .ser files (generated by the runtime execution of your instrumented code). This will generate a combined .ser file for which you can generate a xml or html report from.
Let me know if you need more pointers.
In another question a responder gave a link to a python script they had written that did what you are asking, I moved that "xml combiner" to a gist that is located here

SONAR - Analyzing source code in an Incremental way

I am using sonar for the last few months and want to know that do sonar works in an incremental way or not i.e if i do soanr analysis for the first time on my project code it will definitely analyze all the code but if i do some enhancement on my core source code and update some files then after updation do sonar analysis again on the same code then will sonar analyze all the files OR only analyze files which i have updated?
I am using "Sonar way with Findbugs" as my default quality profile.
Is there any way to use sonar in an incremental way, to analyze only updated files?
Is this possible in sonar or not?
Kindly revert your help will be appreciated..
Thanks in advance..
Sonar does not currently handle incremental analyses.
If you want, you can watch and vote for the following ticket: http://jira.codehaus.org/browse/SONAR-2815
If your task if code quality metrics in a general way, then you can use these tools directly on Jenkins. See FindBugs Plugin , PMD plugin or Checkstyle Plugin. They independently give what you need in the form of "incremental code" reports. But if you have to use SONAR only, then Fabrice's answer is the correct one.
Here the post where the ticket that #fabrice-sonar-team comments was born:
does Sonar support Incremental code quality analysis
You can read Freddy Mallet's explanation about why this functionality is not trivial to be implemented. It requires lot of effort, so as Fabrice said, vote for the ticket! :)
Just adding on since this is the first google result for 'Sonar incremental preview analysis' in stack, and the answers are way too old.
Sonar has plugins available for IDEs such as Eclipse and NetBeans that can run incremental analysis on the changed files alone. This still needs a connection the SonarQube server though.
You may also run the analysis right from Jenkins by passing an additional sonar analysis property - sonar.analysis.mode=incrementalin your Sonar scan build step. This will report the code quality in a full report - will all code issues as well as a light report containing only new issues (since last full scan as recorded in server).
To take one step further use sonar.issuesReport.html.enable=true and publish the generated html reports to your Jenkins build page - Neat and Trim
Sonar documentation here

Resources