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

Computation of Conditional Coverage in Cobertura

I have 2 pieces of code that are giving me trouble. I test them with Unit-Tests, using cobertura to analyze the test coverage, and I don't understand how the conditional coverage is computed. This is the first piece: if ((x.getInt() == a) ||…
Mike B.
  • 190
  • 1
  • 9
4
votes
1 answer

Cobertura, Enums and the Switch statement

In our company, we have a Code Coverage requirement of 90%. Running a Cobertura report, I am only getting 88.8% coverage, and I am seeing the following switch statement highlighted: public TopBrandPrefix getPrefix() { switch(brandParamType) { …
Xetius
  • 44,755
  • 24
  • 88
  • 123
4
votes
1 answer

Code coverage for Android (calabash-android BDD)

I'm testing my android application using calabash-android which provides it's own "test project", with a script that renames it's package to reflect the app under test, and then uses an InstrumentationTestRunner subclass: adb shell am instrument -w…
Nicholas Albion
  • 3,096
  • 7
  • 33
  • 56
4
votes
1 answer

Code coverage for Java: dead or paid?

I'm looking for an answer on code coverage tools. I know variations on this question have been asked…
Ryan Nelson
  • 4,466
  • 5
  • 29
  • 45
3
votes
2 answers

Cobertura Instrumentation

I am trying to get Cobertura working with my Ant build, and specifically just want it to give me a coverage report on my unit tests. I'm using the following directory structure: src/main/java --> main source root src/test/java --> test source…
IAmYourFaja
  • 55,468
  • 181
  • 466
  • 756
3
votes
4 answers

Maven2 Multiproject Cobertura Reporting Problems During mvn site Build

We've got a multiproject we're trying to run Cobertura test coverage reports on as part of our mvn site build. I can get Cobertura to run on the child projects, but it erroneously reports 0% coverage, even though the reports still highlight the…
Nicholas Trandem
  • 2,815
  • 5
  • 30
  • 32
3
votes
3 answers

Can I get a unit test coverage report specificly for a user story?

We are using cobertura to show our unit test coverage, we have only just started using it (Im new to running this team) and our current unit test coverage is very low, rather than just go in and find areas where we need to get this coverage up I…
3
votes
1 answer

How do I troubleshoot "failing" Hudson builds?

I have a job which runs successfully as a maven build, but fails when run in Hudson. The regular output shows BUILD SUCCESSFUL but the build is marked as failed (red ball) and Cobertura reporting is skipped "because build was not UNSTABLE or…
CPhelps
  • 279
  • 1
  • 3
  • 7
3
votes
2 answers

Cobertura report has 100% coverage anywhere

I'm running my webApp using Jetty with my instrumented classes. After the shutdown of Jetty i'm taking the generated .set file and creating a cobertura report using the command line tool. I always get 100% coverage results on any class. It seems…
Ben Bracha
  • 1,377
  • 2
  • 15
  • 28
3
votes
2 answers

Code coverage going down significantly after hibernate upgrade - getters and setters not covered - any ideas?

We have recently upgraded our code base from a 2005 version to the latest version of hibernate. As a result of that, we're seeing significantly reduced code coverage in a number of our packages. These packages are almost entirely POJOs mapped to…
Ashkan Aryan
  • 3,504
  • 4
  • 30
  • 44
3
votes
2 answers

Faulty Line coverage(100%) in cobertura via ant?

I'm using cobertura, but it is giving me 100% line coverage. It is showing only those lines of code which are executed?
3
votes
1 answer

Cobertura - Coverlet.runsettings.xml values ignored by dotnetcore CLI test command

I am trying to generate code coverage for one of my solutions in an Azure DevOps build pipeline. Whilst I have the results of my tests appearing upon build completion along with the Cobertura code coverage report, there are a lot of files and…
jezzipin
  • 4,110
  • 14
  • 50
  • 94
3
votes
1 answer

Is it possible to get code coverage in Azure Devops without publishing the artifact?

I am using cobertura as I need it for report files to publish, and it seems to use a different coverage strategy from the default coverage options so I can't compare the coverages from different reports. Because I use cobertura, it produces a report…
user15716642
  • 171
  • 1
  • 12
3
votes
2 answers

How to exclude test code from code coverage results using Azure DevOps build pipeline

I am compiling an .Netcore application using Azure DevOps build pipeline. In the .Netcore test build task, I have passed the below arguments for collecting the code coverage results: --configuration $(BuildConfiguration) --collect"XPlat Code…
Pradeep
  • 5,101
  • 14
  • 68
  • 140
3
votes
1 answer

Jest - Cannot generate cobertura coverage report for my projects

I'm using jest in a monorepo. I would like to generate a Cobertura report when testing a some of my projects. Jest.config.base.js module.exports = { preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel', transform: { …
Léo Coco
  • 4,022
  • 11
  • 52
  • 97