Myrna van Lunteren wrote:
On 1/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hi,
as part of DERBY-2191 I would like to create a unit test for the
FormatableBitSet class. I would very much like to do this in Junit.
Currently there does not appear to be a Junit framework for unit tests
(there are no suites in the unitTest directory, or the directory
above). So should such a framework be added? Or is it better to add
such a test to the functionTest directory?
--
dt
I saw your question attached to the bug and just did not have an
opinion either way... :-)
It seems to me that unit tests are not functionTests, and because of
that, I'd say to add a junit framework to the unit test area...
However, we obviously run the existing 'unit' tests as part of our
functionTests, so it really is one big pot at the moment. If it's
easier to add a 'unit' directory to the functionTests area, I'd have
no problems with that approach either...
If the community agrees on making it possible to add JUnit tests for
package-private classes by the use of a parallel code tree, I'm adding
another possibility to the table: java/testing/org/apache/derby/.
This location will not interfere with the current test system, nor the
build system (as far as I know). This directory will mirror the package
structure of the Derby code being tested.
Say I were to write a test for
'org.apache.derby.impl.services.daemon.ServiceRecord'. I would add the
test to
'java/testing/org/apache/derby/impl/services/daemon/ServiceRecordTest.java'.
I think it would be wise to keep all tests that do not need to be in
this location elsewhere, for instance in the 'unit' directory mentioned
by Myrna. My motivation for this decision, is that running unit tests
for package-private classes will most likely require a special kind of
setup/environment (due to sealing, packaging/distribution). The more
tests we have that are independent of this, the more tests we can run
the normal way (test code in a separate jar and in its own package
structure).
When it comes to separating function tests and unit tests, I think it
would make it simpler to locate the test for a specific class and that
we could more easily make configurations for running only one kind of test.
I'm a bit worried the distinction will not always be clear-cut, but I
might be wrong. And, will the unit of a unit test always be a single class?
The fact that Dyre found 17 issues, more or less severe, in a single
class, suggests more unit testing could be a way to improve the code
quality. I know it is not the "golden solution" to every problem, but
it might help us get a step further.
just my thoughts on the issue,
--
Kristian
(in other words, I still have no firm opinion on this. :-) ).
Myrna