Questions tagged [cobertura]

Cobertura is a free and open-source Java tool based on jcoverage that calculates the percentage of code and branches covered by tests.

Cobertura is a free and open-source Java tool (commonly called a code coverage tool) based on jcoverage that calculates the percentage of code and branches covered by tests.

Cobertura does this by instrumenting the compiled bytecode. It can be run from the command line, via an Ant task, via a Maven plugin, or via the eCobertura Eclipse plugin. Builds can be made to fail if the code coverage reported by Cobertura does not meet a user-set threshold value. XML and HTML reports can be generated as output.

649 questions
5
votes
3 answers

org.sonar.api.utils.SonarException: Can not add twice the same measure on org.sonar.api.resources.File

I have a Jenkins Job that runs SonarRunner on a Maven project composed of several modules. The build fails when I configure SonarRunner to import Cobertura coverage reports. SonarQube Runner 2.4 Java 1.7.0_55 Oracle Corporation (64-bit) Windows 7…
jewbix.cube
  • 485
  • 6
  • 19
5
votes
1 answer

Cobertura Eclipse Plugin Local site - Download as Zip

I am trying to install the eCobertura plugin for Eclipse. In doing so, I found the update site http://ecobertura.johoop.de/update/. But it's not working for me, probably due to some firewall issues. Is there a bundle I can download and install as…
Sid
  • 4,893
  • 14
  • 55
  • 110
5
votes
2 answers

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…
joewhitedelux
  • 169
  • 1
  • 2
  • 9
5
votes
3 answers

Cobertura doesn't work with Java 7

I am using maven 3.0.4, JRE 1.7.0_09. When I use mvn clean install all my tests passes and everything looks good - here is my surefire plugin configuration: 2.12.4 org.apache.maven.plugins
Noam
  • 3,049
  • 10
  • 34
  • 52
5
votes
3 answers

GCovr does not generate a valid report

I want to set up my Jenkins with Cobertura to track code coverage. Unfortunately I can not generate a valid xml. I'm using: gcovr 2.5-prerelease (r2774) Xcode 4.6.1 Build version 4H512 My project is generating code coverage files correctly, but…
Giuseppe
  • 6,666
  • 2
  • 20
  • 32
5
votes
2 answers

Should we unit test console outputs?

I am working with some legacy code that has some System.out.print commands in itself. My eCobertura plugin shows this lines red, so I want to unit test them. Here in stackoverflow I found a way to unit test console outputs which i thing is very…
javing
  • 12,307
  • 35
  • 138
  • 211
5
votes
1 answer

Running code coverage with Cobertura and Jacoco

I have a bit of a problem getting code coverage reports for both Integration Tests and Unit Tests in Sonar for a Maven Plugin project (which uses invoker plugin for the integration tests). I can't use the default Jacoco coverage tool for the unit…
RCross
  • 4,919
  • 4
  • 44
  • 42
5
votes
2 answers

Relationship between cobertura and surefire

The problem in 1 sentence: "Cobertura does not produce correct code coverage" Below is my pom.xml file
James Raitsev
  • 92,517
  • 154
  • 335
  • 470
5
votes
1 answer

Building grails project successfully only if coverage check passes

I am working on a grails application. We use cobertura to generate the code coverage reports. Now I want to modify the grails project such that the build should fail if the code coverage is less than say, 90%. How can I achieve this in grails?
Npa
  • 617
  • 2
  • 15
  • 26
5
votes
2 answers

hudson cobertura reporting 0

I have a problem that when I run the cobertura target maven, the report always shows 0%.I've tried forking my junit tests, and no luck. I've tried configuring the cobertura plugin in the reporting section and build section of the pom, and also tried…
Jeff Storey
  • 56,312
  • 72
  • 233
  • 406
4
votes
3 answers

Ignore methods in class. cobertura maven plugin

I have maven 3, cobertura maven plugin 2.51 and some classe. I need to know test coverage of my class. But I don't want to test setters/getters. So I wand just to ignore them. org.codehaus.mojo
Dmitrii Borovoi
  • 2,814
  • 9
  • 32
  • 50
4
votes
2 answers

Cobertura and Jetty

I'm trying to get coverage report when running my webapp on Jetty, using cobertura. We already have cobertura running for unit-tests by using the surefire plugin. We also have the failsafe plugin configured for running our integration-tests. I've…
Ben Bracha
  • 1,377
  • 2
  • 15
  • 28
4
votes
2 answers

Cobertura with Maven - fail if coverage below threshold, but still generate site

I'm using Cobertura with Maven. I'd like the build to fail if the coverage is below a given threshold, but I would like the site (including the Cobertura report) to still be generated. This is because developers will need to refer to the coverage…
Rich
  • 15,048
  • 2
  • 66
  • 119
4
votes
2 answers

Java Code Coverage Ideas?

I am working on a Java project where I have an ant build, which runs JUnit tests, which are monitored by Cobertura. That works great and we have kept our coverage very high. For some classes, like Hibernate entities, we have minimal code in them,…
Jack Dreep
  • 125
  • 1
  • 5
4
votes
1 answer

How do I disable Cobertura in a child project when it is enabled by a Maven parent pom?

I have many projects which inherit from a parent pom. I enable Cobertura coverage reports in the parent via a Maven profile that is activated in our Jenkins CI builds. However, I want to disable Cobertura for one child project (while getting…
djb
  • 4,930
  • 1
  • 34
  • 37