You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Steve Vinoski <vi...@iona.com> on 2006/11/19 05:48:07 UTC

[java] junit3 conversion

I just committed changes to convert the Java tests to junit3. While  
going from junit version 4 to 3 is numerically a step backwards and  
thus might feel like the wrong direction to be going, but in practice  
it gives us a number of wins. Now, we get surefire test reports by  
simply running mvn. We can also easily generate test coverage reports  
via "mvn cobertura:cobertura," at least for both the broker and the  
client. We can also generate findbugs reports by running "mvn - 
Dmaven.findbugs.enable=true findbugs:findbugs".

Unit test coverage in the broker directory, as I mention in jira  
QPID-110 [1], is very low: 2% line coverage and 4% branch coverage.  
Granted, many of those classes are covered by tests elsewhere, but as  
those other tests are not unit tests, they lack the isolation that  
good unit tests provide.

Unit test coverage in the client directory is better -- 53% line  
coverage and 63% branch coverage -- but obviously it could be  
increased there as well.

As reported in [2], the common directory has zero unit tests.

Running findbugs turns up some interesting potential errors in the  
code too.

Note that this change also allows us to enforce JDK 1.4 compilation  
for the client, if we want to, as now the client tests no longer use  
annotations. We can enforce this by setting the java version to 1.4  
in client/pom.xml.

The conversion to junit3 itself took awhile, but more because of the  
size of the task rather than any inherent difficulty. We were using  
some of the junit4 annotations in a number of tests, but there were  
none that couldn't be replaced with equivalent junit3 capabilities.

--steve

[1] <https://issues.apache.org/jira/browse/QPID-110>
[2] <https://issues.apache.org/jira/browse/QPID-114>