Generating report only for particular code in file in jenkins - jenkins

I want to generate reports for particular java code(newly added particular method).I do not want to generate report for whole project.Is it possible with Jenkins?I am using JUnit for writing test cases.

try integrating with SONAR, and define include / exclude patterns for you case

Related

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

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..

Is their way to read jenkins test results irrespective of project types?

i'm looking for generic solution to read test results from jenkin's irrespective of project type.
project type may java, python, maven etc.
basically i need to fetch the test execution results from jenkin's build.How can i do it.
Jenkins expects JUnit XML files. If your test setup of choice does not produce them, you would have to create them on your own after reading the results in some other format (this shouldn't be incredibly hard..).
But as you are not alone, others probably have done this work for you. For Python, there seems to be the junit-xml package. Its description says:
Creates JUnit XML test result documents that can be read by tools such as Jenkins

how to generate xml report using python-green for unit testing and coverage?

Try to use python green to control python (2.7.x) code quality, and integrated it within jenkins.
In nose, there is --with-xunit parameter to generate nosetests.xml unit test.
In coverage, it is possible to use xml paramter to generate like coverage.xml coverage report.
Both are very good to be integrated with jenkins.
Do you know how to achieve this in green ?
At the moment, Green does not support any means of producing xml output or integrating with Jenkins.
However, subunit support is planned. Once subunit support is in place, you should be able to hook it up to Jenkins.

Jenkins: files/folders selection from subversion

I'm looking for a jenkins plugin that would allow selection of file(s)/folder(s) for a parameterized build.
The purpose is to be able to select different tests to execute, each test being defined as a .xml file in a svn repo.
eg of repo structure:
tests/business/cars/buy.xml
tests/business/cars/sell.xml
tests/system/core/stuff.xml
I'm not sure if these quite get at what you're looking for, but I found the following two possibilities:
Test In Progress which, based on their GitHub information, should allow you to run tests based on pattern matching and view the progress as they run.
RQM is an IBM tool made to allow you to run specific test cases in a test plan that have a custom property that you configured and provide at test execution time.
edit:
I just found Multi Module Test Publisher, which may be a little closer to what you're looking for. It acts as a replacement for the normal junit plugin and allows you to group junit tests into suites and view statistics on each separately.

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

Resources