当前位置: 代码迷 >> Web前端 >> Cobertura ( Jave testing coverage tool)
  详细解决方案

Cobertura ( Jave testing coverage tool)

热度:642   发布时间:2012-11-25 11:44:31.0
Cobertura ( Jave testing coverage tool).

?

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

  • Can be executed from ant or from the command line.
  • Instruments Java bytecode after it has been compiled.
  • Can generate reports in HTML or XML.
  • Shows the percentage of lines and branches covered for each class, each package, and for the overall project.
  • Shows the McCabe cyclomatic code complexity of each class, and the average cyclomatic code complexity for each package, and for the overall product.
  • Can sort HTML results by class name, percent of lines covered, percent of branches covered, etc. And can sort in ascending or decending order.

Press

  • Measure test coverage with Cobertura, by Elliotte Rusty Harold - Article introducing Cobertura
  • In pursuit of code quality: Don't be fooled by the coverage report, by Andrew Glover - Article discussing how to interpret a coverage report and how to best utilize a coverage tool
  • Using Cobertura with Appfuse

?

Why use a coverage tool?

No matter how good such methodologies are, and how diligently they're followed in an organisation, it isn't possible to ensure that software testing is as comprehensive as it could be. That's where tools can help.

Cobertura is a free, simple and easy-to-use tool that will complement your existing Java development practices. It helps you discover exactly where your software is being tested and, more importantly, where it isn't. Cobertura will help you to view your software from a number of levels, from the entire system right down to an individual line of code.

Why use Cobertura?

Sure, there are other coverage tools around, so what makes Cobertura different?

Coverage analysers work by adding instrumentation. For Java, coverage analysers fall into three categories: those that insert instrumentation into the source code, those that add instrumentation to the Java byte-code, and those that run the code in a modified JVM. Cobertura adds instrumentation directly to the bytecode. We feel this is the best approach, since it does not require a modified VM, but still retains a big speed advantage over having to compile all your source code twice.

Secondly, Cobertura is easy to integrate with Apache Ant. It comes with it's own Ant task definitions for you to use. You can choose to instrument any code you wish, from a single class to an entire system.

Finally, Cobertura is completely free and not time-locked, so you can begin to use it today, without having to worry about what to do at the end of an evaluation period. What's more, we believe Cobertura is so easy to use, you'll be up and running in no time. So why not spend the next 15 minutes getting up and running with Cobertura. In that time, you'll certainly find out which parts of your code are completely tested, and where your code could do with a bit more testing.

?

?

http://cobertura.sourceforge.net/

?

http://www.codehaus.org/

?

?

  相关解决方案