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
4
votes
1 answer

Skip a *test* with cobertura plugin

We're in the middle of developing a big project, with many interacting modules and teams working on said modules. we have implemented CI with jenkins, which does periodic and on-commit builds that run junit tests, fitnesse tests, and cobertura…
JGN
  • 85
  • 1
  • 8
4
votes
1 answer

Unusually low test coverage reported when using Cobertura with Gradle and Groovy code

I'm developing a Gradle plugin and I'm trying to configure my project to let me get code coverage metrics on it. I have unit and integration tests based on the Spock framework. I've tried using both Jacoco and Cobertura to analyse my project. Here…
Tagc
  • 8,736
  • 7
  • 61
  • 114
4
votes
1 answer

Generating multiple Cobertura report formats via Maven command line

With Maven I can generate multiple different types of code coverage reports with Cobertura by changing the reporting section of my POM, ala ... org.codehaus.mojo cobertura-maven-plugin
ingyhere
  • 11,818
  • 3
  • 38
  • 52
4
votes
1 answer

how to run cobertura during mvn install phase

I have the following plugin defined for cobertura as follows. I have to run mvn cobertura:cobertura to get the code coverage report. How to edit the pom so that mvn install runs the cobertura ? org.codehaus.mojo
atul
  • 95
  • 2
  • 5
4
votes
1 answer

SonarQube 4.4 not displaying cobertura unit tests or code coverage for grails 2.4.3 with spock tests

I have SonarQube 4.4 installed on my machine. I am trying to generate metrics for a grails (2.4.3) project that has tests written in Spock framework. However, sonar does not show unit tests results or unit tests coverage. I verified that cobertura…
RRK
  • 465
  • 2
  • 7
  • 21
4
votes
1 answer

Cobertura plugin for grails 2.3.9 does not work

I have a grails 2.3.7 project that is using cobertura plugin, it works perfectly fine. But when I upgraded to 2.3.9 it stopped working. This is some of the relevant parts of the stacktrace that I get. Error Cobertura: Error reading from object…
froi
  • 7,268
  • 5
  • 40
  • 78
4
votes
3 answers

Cobertura coverage ignore annotation in maven project?

I am trying to exclude certain methods from Unit test coverage. I am using Cobertura because I found out that since version 2.0 they introduced a coverage ignore annotation for excluding methods and classes:…
4
votes
1 answer

How does the Jenkins Cobertura plugin operate to enable source code viewing?

I'm trying to get a build in Jenkins to show a coverage report of a Java unit test run. I can get the report at the high level showing that coverage has occurred at the class and method level, but part of the report where I can view the source code…
Lance Kind
  • 949
  • 12
  • 32
4
votes
1 answer

Mocha istanbul coverage xml file generation

I'am trying to generate an xml file that contains informations about unit test coverage that i made with mocha ( Backend unit tests in Angularjs ). I executed my front end unit tests with jasminejs and i can integrate the frontend coverage with…
badaboum
  • 843
  • 2
  • 17
  • 28
4
votes
3 answers

Sonar-runner not importing cobertura coverage.xml report for Groovy/Grails project

I have generated coverage reports with cobertura outside of sonar and would like to "reuse" them and import them into Sonar. Is this possible. Sonar 3.73 Sonar-Runner 2.3 sonar.projectKey=org.me:artifactname sonar.projectName=Project…
Dave Brunkow
  • 352
  • 6
  • 20
4
votes
1 answer

Why does Cobertura report 0% coverage when run through the Eclipse plugin?

(There are a tonne of these questions, but all the ones I can find relate to Maven. Before you suggest this one is a duplicate, please understand that this doesn't relate to Maven in any way.) I am using Cobertura within Eclipse to determine my…
sdasdadas
  • 23,917
  • 20
  • 63
  • 148
4
votes
3 answers

java.lang.RuntimeException: java.lang.ClassNotFoundException:

I get following exception with new cobertura (2.0.2..). I guess it is some how related to new object creation immediately in a new block. WARN instrumentClass, Unable to instrument file…
Jayan
  • 18,003
  • 15
  • 89
  • 143
4
votes
2 answers

Gradle - how to run ant task with "-" in name

I want to use cobertura in my gradle build so I created task in this way: ant.typedef(resource: 'tasks.properties', classpath:configurations.cobertura.asPath) And now I want to run cobertura-instrument. The problem is that I don't know how to run…
pepuch
  • 6,346
  • 7
  • 51
  • 84
4
votes
1 answer

Cobertura NoClassDefFoundError error during Tomcat7 shutdown

I am using the latest Cobertura 2.0 jar, and have done the setup as defined here https://stackoverflow.com/a/5319237/870392. After executing my test cases when I try to shutdown tomcat (ver 7) to collect the coverage data I get the following…
shrivatsa
  • 75
  • 1
  • 7
4
votes
1 answer

Why the variations on Ant plugin taskdefs?

I'm really confused with the proper (most modern, best practices, etc.) way of defining taskdefs for Ant plugins. Below is a snippet of code that I pieced together taken from one of our in-house Java app's build.xml. Please note that all of the…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756