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
660
votes
10 answers

Clearing coverage highlighting in Eclipse

After running coverage reports in Eclipse (using cobertura or an EMMA plugin), my source code files get highlighted in green, red and yellow depending on which lines of code were covered by tests. How can I clear this highlighting after I'm done?
Charbel
  • 14,187
  • 12
  • 44
  • 66
121
votes
3 answers

Differences between Line and Branch coverage

What is the difference between line and branch coverage in Cobertura Maven?
Emmanuel Demey
  • 2,158
  • 4
  • 18
  • 21
83
votes
1 answer

Can I use Cobertura on Unit Tests with PowerMock?

Problem I am setting-up unit-test code coverage for an Android library which uses Robolectric to run the tests and PowerMock/Mockito for mock-testing. However, running unit-tests with Cobertura results in the following…
PLNech
  • 3,087
  • 1
  • 23
  • 52
62
votes
5 answers

Jenkins + Play 1.2.4 : problems with cobertura lock files / report

We have a Play 1.2.4 application and we got Jenkins (on Ubuntu) for the application. We're having problems with Cobertura. After running the tests (succesfully), every now and then, we get the following…
Touko
  • 11,359
  • 16
  • 75
  • 105
55
votes
5 answers

Exclude methods from code coverage with Cobertura

Is there a way to exclude code from inclusion into Cobertura coverage reports? We have some methods that should not be included in the coverage report and therefore not drive down the coverage numbers. I know that Clover has such a functionality,…
ReneS
  • 3,535
  • 2
  • 26
  • 35
55
votes
7 answers

Testng, Emma, Cobertura, coverage and JDK 7 result in ClassFormatError and VerifyError

I have switched to the newest JDK 7 and I am having problems with running testng unit test on byte code that is fiddled by emma coverage tool. None of my test cases are run correctly and for most of them I am receiving such errors. …
Jagger
  • 10,350
  • 9
  • 51
  • 93
54
votes
4 answers

Cobertura code coverage report for jenkins pipeline jobs

I'm using the pipeline plugin for jenkins and I'd like to generate code coverage report for each run and display it along with the pipeline ui. Is there a plugin I can use to do that(e.g. Cobertura but it doesn't seem to be supported by pipeline)?
ebnius
  • 910
  • 2
  • 8
  • 14
42
votes
2 answers

Gitlab pipeline - reports config contains unknown keys: cobertura

I'm not able run the gitlab pipeline due to this error Invalid CI config YAML file jobs:run tests:artifacts:reports config contains unknown keys: cobertura
Shashikumar KL
  • 1,007
  • 1
  • 10
  • 25
41
votes
8 answers

Maven Cobertura plugin not generating coverage.xml

I am trying to generate a coverage.xml so that I can reference it in Cobertura plugin of Hudson, but the file is not being created. I've added the following to my POM
kjl
  • 912
  • 2
  • 9
  • 15
36
votes
7 answers

JUnit: testing helper class with only static methods

I am testing a helper class with only static methods with JUnit4 and Cobertura. Testing methods was easy task and is done already. However, cobertura shows that the class is not covered by tests completely, as it is not instantiated anywhere. I…
Mateusz Chromiński
  • 2,742
  • 4
  • 28
  • 45
30
votes
5 answers

Cobertura & Java 7 support

Any ideas when cobertura will support java 7? Found http://sourceforge.net/tracker/index.php?func=detail&aid=3295711&group_id=130558&atid=720018 We preferred cobertura over emma and other code coverage tools and looks like we have to redo all those…
crankparty
  • 1,230
  • 3
  • 17
  • 26
30
votes
5 answers

Is there anyway to merge cobertura coverage xml reports together?

I have c++/c application with a lots of unit tests. I would like to get overall coverage and also individual coverage of each test with condition that each test can be run only once. Format of coverage must be xml (cobertura xml) for jenkins…
jan-hybs
  • 624
  • 2
  • 8
  • 18
30
votes
7 answers

cobertura on maven multi module project

I have a Maven project with 4 modules - 3 of them contain code and some tests (testing equals and hashcode of the classes) whereas the 4th module is for testing the 3 other modules. Now I want to run the cobertura code coverage tool to get an…
pangratz
  • 15,875
  • 7
  • 50
  • 75
29
votes
6 answers

Running integration tests with Cobertura Maven plugin

I am having trouble getting the Cobertura plugin to run integration tests in Maven. The closest answer to this question I have found is http://jira.codehaus.org/browse/MCOBERTURA-86. However, the issue remains an open bug. I tried the…
Candy Chiu
  • 6,579
  • 9
  • 48
  • 69
25
votes
4 answers

Cannot install Cobertura plugin for Eclipse

I am getting following error message when I tried to install cobertura plugin in eclipse kepler (java/j2ee version) through eclipse market place. Cannot complete the install because one or more required items could not be found. Software being…
1
2 3
43 44