Clover - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Clover

Description:

Historical charting of code coverage and other metrics ... S. Gornett, 'Code Coverage Analysis' http://www.bullseye.com/coverage.html ... – PowerPoint PPT presentation

Number of Views:87
Avg rating:3.0/5.0
Slides: 19
Provided by: alanwi8
Category:
Tags: bullseye | clover

less

Transcript and Presenter's Notes

Title: Clover


1
Clover
  • http//www.cenqua.com/clover
  • Commercial tool requires license
  • Supports method, statement, and branch coverage
  • Reports its findings in multiple formats
  • From project level down to individual lines of
    source code
  • Historical charting of code coverage and other
    metrics
  • Plug-in versions available for Eclipse, NetBeans

2
Clover plugin for Eclipse
3
Clover coverage filters
  • One can choose not to instrument certain types of
    blocks in the code (e.g. assertions and exception
    catching), in order to focus on the coverage of
    interest.

4
Emma
  • Open-source tool
  • Supports class, method, basic block, and line
    coverage.
  • Fractional line coverage supported, but not
    branch coverage.
  • Standalone version works with Ant builds
  • http//emma.sourceforge.net
  • Eclipse plugin EclEmma also available
  • http//www.eclemma.org

5
Emma
  • Uses bytecode instrumentation.
  • Classes can be instrumented in advance, or during
    class loading.
  • Tool keeps a metadata file to associate bytecode
    with source code
  • A regular compile will allow for only limited
    metadata.
  • A compile with debug option will provide more
    information to support branch coverage.

6
Block Coverage
  • Block coverage assumes that if a block of
    statements without branches is entered and
    exited, all statements in the block were
    executed.
  • That is, the counter is at the end of the block,
    instead of before the source code statement.
  • Result If an exception occurs in the block, the
    entire block is not recorded as having executed.
  • This may be fine for application source code, but
    it does not work well with JUnit test source
    code.
  • JUnit throws exceptions internally when tests
    fail, so the test may not have appeared to be
    executed.

7
Emma coverage report
8
Emma source code annotations
9
Fractional line coverage
Only part of conditional executed
Loop increment not executed
10
Anomalies with byte code coverage
  • There are cases where the compiler may emit
    multiple copies of object code for a single
    instance of source code.
  • In the above example, there is an instance
    variable initialized for each of two
    constructors. However, only one constructor is
    called.

11
Coverlipse
  • Open source Eclipse plug-in
  • http//coverlipse.sourceforge.net
  • Provides block coverage, all-uses data flow
    coverage
  • No branch coverage
  • Uses Apache BCEL to instrument bytecode

12
Line coverage report
13
All-uses coverage report
14
All-uses coverage report
15
Cobertura
  • Open source tool for Java code coverage
  • http//cobertura.sourceforge.net
  • Measures line coverage, branch coverage, and
    McCabe cyclomatic complexity metric for methods.
  • Branch coverage requires compilation with debug
    option.
  • Must be run as an Ant task, with four stages
  • Compile source code
  • Instrument classes
  • Run code
  • Generate report

16
Cobertura summary report
17
Cobertura detail report
18
References
  • Clover http//www.cenqua.com/clover
  • Emma
  • http//emma.sourceforge.net
  • http//www.eclemma.org
  • Coverlipse http//coverlipse.sourceforge.net
  • Cobertura http//cobertura.sourceforge.net
  • A. Glover, Dont be fooled by the Coverage
    Report, IBM developer works article
  • http//www-128.ibm.com/developerworks/java/library
    /j-cq01316
  • S. Gornett, Code Coverage Analysis
  • http//www.bullseye.com/coverage.html
Write a Comment
User Comments (0)
About PowerShow.com