Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
Cobertura
[go: Go Back, main page]

"Cobertura is my new coverage tool of choice, and I hope to give something back. I hope you'll get involved, too."

–Mike Clark, author of Pragmatic Project Automation

What is Cobertura?

Cobertura is a free Java tool that calculates the percentage of code accessed by tests. It can be used to identify which parts of your Java program are lacking test coverage. It is based on jcoverage.

Features

Press

News

5 June 2007

We've released Cobertura 1.9! There is much improved branch/conditional coverage and a new maxmemory attribute that can be used if instrumentation needs more memory. See below for the full list of changes.

  • Much improved branch/conditional coverage. Information on whether the true as well as the false of an if statement is collected. Also, information on the branches of a switch statement (including the default) is collected. (Jiří Mareš)
  • Assume Java source files are saved as UTF-8 instead of the computer's default encoding.
  • Write all HTML and XML reports in UTF-8 instead of the computer's default encoding (Naoki Iwami).
  • Fix a bug where the Cobertura ant tasks would not work correctly in Microsoft Windows when Cobertura was installed on a different drive than the drive from which you're running ant (Srivathsan Varadarajan).
  • Added a "maxmemory" attribute to the instrument, merge and report ant tasks (Matt Cordes).
  • Improve support for Maven and similar environments where control over system properties is difficult such as app servers, IoC containers, IDEs, etc. Setting the datafile location is difficult in these environments. To correct this, a cobertura.properties file located in the classpath is used to properly set the net.sourceforge.cobertura.datafile property. (Joakim Erdfelt)
5 November 2006

We've added two new developers, Jiří Mareš and Joakim Erdfelt! Jiří has been working on improving the way we handle branch coverage, and Joakim is the author of the Cobertura plugin for Maven 2. Rejoice.

10 April 2006

The first set of binary packages we uploaded were built with Java 1.5. Sorry about that. We've uploaded new packages that were compiled with 1.3.1.

23 May 2006

We've added John Lewis as a developer on the project! The more the merrier. He contributed some of the bigger changes in Cobertura 1.8, and he's been pretty active on the cobertura-devel mailing list.

10 April 2006

After 4 long months we've released Cobertura 1.8! Lots of good changes in this release: show the total number of lines and branches in the HTML report, support for Groovy, allow multiple JVMs to cleanly write to the same data file, and more robust instrumentation of archives (and even archives inside of archives!) See below for the full list of changes.

  • Ability to have multiple <ignore/> regular expressions in the instrument task (Alexei Yudichev).
  • Ability to specify a minimum branch coverage rate and line coverage rate for each package when using cobertura-check.
  • Show the number of lines and branches covered and the total number of lines and branches in the HTML report.
  • Support for instrumenting classes written in Groovy.
  • Lock the data file before trying to write to it. This allows multiple JVMs (or multiple class loaders within a single JVM) to write to the same coverage data file with no problems (John Lewis).
  • Ability to instrument classes on a given classpath instead of specifying filesets (John Lewis).
  • Ability to specify which classes will be instrumented using regular expressions (John Lewis).
  • Archives within archives will be instrumented if you specify an includeClassname regular expression (John Lewis).
  • If instrumenting an archive, remove any signatures and checksums, since they will no longer be valid (John Lewis).
  • Removed the Class-Path line from cobertura.jar. You may need to modify your Cobertura taskdef to include the jars in Cobertura's 'lib' directory. See our Ant task web page for an example.
  • Reorganized libs into a flatter directory structure--you may need to update your ant scripts.
  • Upgraded from asm 2.1 to asm 2.2.1. No code changes were needed.
  • Copied portions of classes from JavaNCSS into Cobertura so that we don't need to include the entire JavaNCSS and CCL jars.
17 March 2006

Benoit Xhenseval and the QALab folks have added support for Cobertura to their product. From their website, "[t]his project collects and consolidate data from several QA tools, like pmd, checkstyle, FindBugs, Cobertura and Simian and keeps track of them overtime. This allows developers, architects and project managers alike to be presented with a trend of the QA statistics of their project."

For anyone interested in seeing coverage statistics-over-time, check out their report.

6 December 2005

We've just released Cobertura 1.7. We fixed the problems with the merge task, as well as a few other bugs. The full list of changes is below.

  • log4j is no longer used by the Cobertura classes that are accessed by instrumented Java code. This means you will not need to add log4j to your project's classpath in order to use Cobertura (but log4j is still required when instrumenting and reporting).
  • Upgraded from asm 2.0 to asm 2.1. No code changes were needed.
  • Improved the merge task. It should work correctly now (with help from Björn Beskow).
  • Fixed the ability to specify a data file in the merge task.
  • Changed the command-line interface to the merge task and added a helper batch/shell script.
  • Added better error checking to the merge task.
  • Fixed a bug where an empty or incomplete coverage data file would be written when you test classes inside Tomcat, and you stop Tomcat using the shutdown.bat or shutdown.sh scripts. This would result in an EOFException when running cobertura-report.
  • Added support for classes compiled with AspectJ.
22 August 2005

As promised, we've just released Cobertura 1.6 which includes support for generating reports using different source trees and instrumenting many directories of classes with one call to cobertura-instrument. See our ant task reference for examples.

  • Can now use multiple filesets in the cobertura-instrument task (Thanks to Grzegorz Lukasik).
  • Can now use multiple filesets in the cobertura-report task (Thanks to Jeremy Thomerson, Grzegorz Lukasik and James Seigel).
  • No longer using the Java version of GNU GetOpt
  • Fixed a bug where the total number of classes displayed in the HTML report included anonymous classes when it should not have.
5 August 2005

We've added a new developer, Grzegorz Lukasik, to the project!

5 August 2005

We've decided to release Cobertura 1.5. This release includes a lot of good changes. However, it does not yet support instrumenting multiple directories for classes or generating a report using multiple source directories. Cobertura 1.6 will include both of these enhancements, and will hopefully be released in about two weeks.

The changes in 1.5 are:

  • Shortened the header shown when running Cobertura (Thanks to Jarkko Viinamäki).
  • Don't save the data file twice after instrumenting.
  • Print a warning when running cobertura-report with a data file that does not contain information from the instrument step.
  • When instrumenting, you can now specify a zip, jar, war, ear or sar file and Cobertura will instrument any classes inside of the archive. You must explicity give the name of the archive when instrumenting--giving the name of the directory containing the archive will not work (Thanks to Grzegorz Lukasik).
  • Fixed a bug where the class list in the HTML reports did not show multiple classes with the same name, but in different packages.
  • Add a timestamp and version number to all HTML reports.
  • Add a timestamp and version number to all XML reports.
  • Add the combined line-rate and branch-rate for all packages to all XML reports.
  • Fixed the merge task (Thanks to Mark Sinke).
  • The check task now supports checking against a project's total branch and line coverage rates (Thanks to Nathan Wilson).
  • The check ant task now allows you to fail the ant build, if desired (Thanks to Nathan Wilson).
  • The check task can set an ant property to "true" on failure (Thanks to Alex Ruiz).
  • Changed some of the parameters for the check task. See the online documentation for usage information.
  • The command line Windows batch scripts work better.
30 May 2005

Some bugs sprung up after we released the last version, so we decided to release 1.4 (after fixing the bugs, of course).

The changes in 1.4 are:

  • Fixed a bug that sometimes resulted in a StringIndexOutOfBoundsException when running cobertura-report (Thanks to Grzegorz Lukasik).
  • Fixed a bug where classes without coverage data ("N/A") were not always sorted correctly in the HTML report (Thanks to Olivier Parent).
  • Fixed a bug where the code complexity column would not always sort correctly in locales that use a comma to split the decimal part of the number (Thanks to Olivier Parent).
  • Show "N/A" in the branch column of the HTML report for classes and packages that do not have any branches.
20 May 2005

A little over two months later we've released version 1.3. There were some big changes to the code that will hopefully make future development a bit smoother. And of course, there's that "real life" thing that always delays things.

We've added some ant task and command line examples to the web page. Please let us know if you see any mistakes, or if you find something that needs clarification.

The changes in 1.3 are:

  • Increased speed of HTML reports by filtering the files read in to determine cyclomatic complexity numbers on.
  • In the lower left pane of the HTML reports, classes are now sorted only by their class name (instead of by their package name plus class name).
  • Changed the format of the XML reports to something that is hopefully easier to use and more natural. This unfortunately breaks backward compatability.
  • We're using a DTD for the XML reports now. See http://cobertura.sourceforge.net/xml/coverage-01.dtd
  • Added the ability to specify the location of the coverage data files from the ant tasks and the command line.
  • More user-friendly error checking and reporting.
16 March 2005

We decided to release Cobertura 1.2 because of a bug in the XML reports in 1.1. If you use the XML reports you'll definitely want to upgrade, otherwise you're safe with 1.1. Also, Cobertura 1.2 (and 1.1, and maybe 1.0) requires a 1.4 or newer JVM. Is this a problem for anyone? If so, please send an email to our mailing list (cobertura-devel@lists.sourceforge.net) and let us know what version of the JVM you would like to use.

Here are the changes in 1.2:

  • Fix a bug that caused the XML reports to be invalid XML (they were missing the </package> tag).
  • Use Java 1.4 pattern matching and remove Jakarta ORO.
8 March 2005

We just added our first new developer, Jeremy Thomerson, to the team! Look forward to seeing good things from him in the future.

8 March 2005

Just released 1.1! It contains a few bug fixes, some feature improvements, and performance enhancements. Here's the list of changes:

  • Fix a bug in the syntax highlighting code of the HTML report generation. Previously, the highlighting for single quotes containing "\\" would not end correctly.
  • Check the third party jars into CVS using the correct CVS substition flag (binary, not ASCII).
  • Temporary files created by the instrument ant task and merge ant task are now deleted after the ant task finishes.
  • Switch the instrumentation classes to use ASM instead of Apache BCEL. There are three benefits to this:
    1. BCEL was throwing exceptions with some source code compiled with JDK 1.5--ASM works fine.
    2. ASM is licensed under the revised BSD license, which is compatable with the GPL, which allows us to remove the questionable exception for BCEL from the license.
    3. Instrumentation is about 5 times faster with ASM than BCEL.
  • Modify the HTML reports so that classes without line number information will appear as "Not Applicable." This includes skeleton classes, stub classes, interfaces, or anything not compiled with debug=true.
  • Fix bug #1151777 with a patch from Jeremy Thomerson. Previously we were not escaping some characters correctly in the generated XML coverage report (specificially < and >).
  • Set the class-path in the cobertura.jar manifest file correctly.
  • Fill feature request #1151779 with a patch from Jeremy Thomerson. This changes the structure of the XML report so that <classes> are enclosed inside <packages>.
12 February 2005

Alright, everything is in CVS now and I've released 1.0. Please try it out and file bug reports for anything that doesn't work for you. I should point out that the original jcoverage has an Eclipse plugin. I don't use the plugin, and haven't tested it in Cobertura, so I'm not providing a package for it. However, I left the build steps for the Eclipse plugin in place, so if you want to use it you should be able to download a source distributable and compile yourself. The major changes between Cobertura 1.0 and jcoverage 1.0.5 are below.

  • Applied a patch from Joakim Erdfelt to fix a bug where jcoverage would fail to instrument classes if you attempted to instrument a very large number of classes (in the hundreds).
  • Rewrote the HTML reporting and included code complexity in the output. I should point out that parts of these reports are influenced by the Maven Jcoverage plugin, the Clover reports, and the JUnit HTML reports.
11 February 2005

I uploaded the web page and did some initial project setup. I'll give my code a good once-over then import it to CVS soon.

10 February 2005

The Cobertura project was created on sourceforge.