[Biojava-l] Unit tests
Thomas Down
td2@sanger.ac.uk
Wed, 9 May 2001 16:58:55 +0100
On Wed, May 09, 2001 at 05:23:44PM +0100, Simon Brocklehurst wrote:
>
> o Location of test classes - they need to be inside packages so that you can
> write tests for package-private classes
While it's true that you need to put your test classes in the same
Java package in order to test private stuff, that doesn't
necessarily mean they have to live in the same directory tree.
We can have a structure like
src/
org.biojava.bio.foo.PrivateImplementation.java
test/
org.biojava.bio.foo.TestCases.java
That keeps a nice, clean, distinction between `real' code and
tests.
I'd also tend to argue that (most of the time, anyway) tests
should be testing the behaviour of public API -- what goes
on behind the scenes is, by definition, private, and if this
changes it doesn't mean there's a bug, so long as all the public
API still behaves as expected. (Although in practice, yes,
private tests might be useful in a few of the more complex
cases).
Thomas.