You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Gaojinchao <ga...@huawei.com> on 2011/05/27 09:51:22 UTC

about unit test coverage

I use clover plugin to get hbase unit test coverage but the report result is not correct.
my hbase version is 0.90.3 and in my pom file,I define Clover plugin like this:
...........
<build>
<pluginManagement>
         <plugins>
         <plugin>
         <groupId>com.atlassian.maven.plugins</groupId>
         <artifactId>maven-clover2-plugin</artifactId>
         <version>3.0.5</version>
         <configuration>
         </configuration>
         <executions>
         <execution>
                   <goals>
                            <goal>instrument</goal>
                   </goals>
         </execution>
         </executions>
      </plugin>
...........
  <reporting>
    <plugins>
      <plugin>
        <groupId>com.atlassian.maven.plugins</groupId>
        <artifactId>maven-clover2-plugin</artifactId>
                   <version>3.0.5</version>
        <configuration>
        </configuration>
      </plugin>
           .............
when I execute mvn compile clover2:instrument test clover2:clover,it will test twice.
the first time test almost all failed.the second time all OK. And iI found that the first time test by
[clover2:instrument],each failed test was tested too short time.

I know by [mvn compile clover2:instrument] ,clover will Instrument all sources using Clover and forks a
custom lifecycle to execute project's tests on the instrumented code so that a Clover database is created.
but I don not kown why the test almost all failed by [mvn compile clover2:instrument],if that I can not correctly
get the coverage Report from Clover database. by [mvn clover2:log] that the coverage is very low,it is incorrect.

anyone got the hbase unit test coverage report by clover or other plugin(in fact,already I done it by  Cobertura and emma,but all dail)?
who can help me find what is wrong?
thanks.
 mvn compile clover2:instrument test clover2:clover
.........
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.apache.hadoop.hbase.master.TestHMasterRPCException
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.032 sec <<< FAILURE!
Running org.apache.hadoop.hbase.regionserver.TestColumnSeeking
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.022 sec <<< FAILURE!
Running org.apache.hadoop.hbase.regionserver.TestMemStoreLAB
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.457 sec
Running org.apache.hadoop.hbase.client.TestMultipleTimestamps
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.021 sec <<< FAILURE!
Running org.apache.hadoop.hbase.regionserver.wal.TestLogRolling
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.021 sec <<< FAILURE!
Running org.apache.hadoop.hbase.TestZooKeeper
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.022 sec <<< FAILURE!
..........
............
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.apache.hadoop.hbase.master.TestHMasterRPCException
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.461 sec
Running org.apache.hadoop.hbase.regionserver.TestColumnSeeking
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.989 sec
Running org.apache.hadoop.hbase.regionserver.TestMemStoreLAB
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.95 sec
Running org.apache.hadoop.hbase.client.TestMultipleTimestamps
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 62.014 sec
Running org.apache.hadoop.hbase.regionserver.wal.TestLogRolling
.............
------------------------------------------------------------------------------------------



mvn clover2:log
............
Coverage Overview -
Coverage:-
      Methods: 1265/10165 (12.4%)
   Statements: 4336/48063 (9%)
     Branches: 1043/15780 (6.6%)
        Total: 9%
Complexity:-
   Avg Method: 2.091884
      Density: 0.44241932
        Total: 21264
...........