On Tue, Mar 31, 2009 at 12:36 PM, jduprez4junit <jethrie@...> wrote:
> I just happened to stumble on a fairly big heap of tests which are organized
in a class hierarchy (OrderDaoTestCase DaoTestCase extends BaseTestCase extends
TestCase). jUnit4 annotations are disregarded in OrderDaoTestCase, as it
indirectly extends TestCase.
>
> If I want to benefit from jUnit4 annotations in OrderDaoTestCase, I can
either:
> - break this hierarchy before extending BaseTestCase: this would be heavy work
(lots of utilities in BaseTestcase, could have been written as static utilities
or helper classes, but the legacy situation is that most of these useful
utilities are based on instance methods or protected fields).
> - simply making BaseTestCase not extend TestCase: that would break those test
subclasses that do rely on being indirect TestCase subclasses (ex: non-static
assert methods).
If you annotate OrderDaoTestCase with @RunWith(JUnit4.class), does
everything work?
David Saff
>> 2) Where did you look in the documentation? Where would be a natural place
to see this behavior described?
>
> OK this is a trick question because I mentioned "the documentation" :o)
> Your question made me search for the docs I had read, and I realized that most
of them are not from the jUnit team (or on the jUnit website).
> As far as the standard doc is concerned, well, this issue is probably too
far-fetched to deserve an entry in the short cookbook (which no more describes
3.8-style anyway).
> I expected I would find it in the FAQ (must not be as frequent as I thought).
>
> This is probably merely a subject for a tutorial on migrating from 3.8, which
may seem obsolete as of today, but I'm sure there still exists lots of 3.8 test
code in the field.
As you've gathered, we've been relying on Google and the far corners
of the Internet to do some of our documentation for us, as we
concentrate our limited time on functionality. This is missing.
Perhaps you could log a feature request at SourceForge to update the
FAQ? Thanks,
David Saff