db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: [junit] Move JUnit base/utility classes???
Date Tue, 22 Aug 2006 12:59:50 GMT
Andreas Korneliussen wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Kristian Waagan wrote:
> <>
> 
>> Hi,
>>
>> I still have a question regarding the placement of JUnit tests. I have
>> brought this up before, but got very little response (I did get some,
>> see below).
>>
>> Do we want to support [unit] testing of package private classes?
> 
> Maybe it is sufficient to support testing the public methods of public
> classes ?

Hi Andreas,

In my opinion, it is not.
There are some quite complex classes which are not part of the public 
API. Testing these indirectly through the public API is a lot of work, 
and it might be hard to construct all variations/codepaths.

I recently experienced this problem. I "solved" it by writing my own 
unit test and placing it in the appropriate package, which was not 
contributed to the community. But maybe this is more of an exception 
than the general case. The existing code base does not have this kind of 
tests.

If the consensus is not to support unit tests of this kind, I will 
either write indirect tests instead or test less of the code. My worry 
is the latter approach...



-- 
Kristian

> 
>> The easiest solution to achieve this is to keep a mirrored/separate
>> source tree, where the tests are put into the corresponding Derby
>> production code package (for instance 'org.apache.derby.iapi.types').
>>
> 
> I think there are some testclasses which are in the same source tree as
> the derby source, however the .class files are packaged into
> dergbyTesting.jar.  I.e:  org/apache/derby/impl/drda/TestProto.class
> 
> 
>> Andrew brought up the concern wrt building and distribution. We do not
>> want to include the testing classes in the releases. Further, JAR
>> sealing is causing headaches (unable to distribute the test classes in a
>> separate JAR).
>>
> 
> Yes, and that is probably why derbynet's manifest has:
> 
> Name: org/apache/derby/impl/drda/
> Sealed: false
> 
> 
> Andreas
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.4 (SunOS)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFE6vbY36DpyYjYNyIRArhHAJsE/FmJpRui8eGLjCGZR2RCj4DLIACeOmtf
> Vvr1uNT1BlAslq+Oahti3HI=
> =nXDM
> -----END PGP SIGNATURE-----


Mime
View raw message