Strange jacoco coverage report in Derby

  • Siddharth

    Siddharth - 2012-07-12


    Apache Derby has recently started utilizing jacoco as a code coverage tool in addition to emma.
    While generating code coverage report for PreparedStatement in jdbc4 environment , we noticed that some methods are being actually called but are shown as uncovered in Jacoco's report.

    For example: setNBlob is called while executing the test, but it is shown as having 0% coverage in the report.

    It would be helpful to know about logging/tracing options available in jacoco and other options that may help in debugging the strange coverage reports.


  • Marc R. Hoffmann

    How does the test code look like for setNBlob? Note that only blocks that exit regularly are marked as covered. If one of the methods in setNBlob throws an exception you will see no coverage for this method.


  • Siddharth

    Siddharth - 2012-07-13


    The code that tests it is:

    public void testSetNClobLengthlessNotImplemented()
                throws SQLException {
            try {
                ps.setNClob(1, new StringReader("A string"));
                fail("setNClob(int,Reader) should not be implemented");
            } catch (SQLFeatureNotSupportedException sfnse) {
                // Do nothing, this is expected behaviour.

    It indeed throws an exception which according to the test is expected behaviour.

  • Marc R. Hoffmann

    Then everything works as designed: As long as you don't also test the control flow without exception (normal return) this method is not shown as covered.

  • Nufail

    Nufail - 2012-07-13


    In the code snippet akssps011 posted,


    calls the setNClob method in LogicalPreparedStatement40 class. It in turn calls the  setNClob method in PreparedStatement40 class. In this case PreparedStatement40 class shows that method as covered. But in LogicalPreparedStatement40 it is shown as not covered.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks