Skip to search.

(*) Scheduled Maintenance: We are undertaking some essential, but extensive maintenance to improve Yahoo! Calendar. Your Group Calendar is being migrated to a much improved version of Yahoo! Calendar. During the maintenance period, you may not have access to your Groups Calendar. We sincerely apologize for this inconvenience. Your Groups Calendar is in great shape and we are working to have it available again as quickly as possible - Yahoo! Groups & Yahoo! Calendar Team

junit · JUnit, the Java unit testing framework written by Kent Beck and Erich Gamma.

Group Information

  • Members: 7749
  • Category: Java
  • Founded: Nov 6, 2000
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.
Click here for the latest updates on Groups Message search

Messages

  Messages Help
Advanced
Hello, as advised on http://www.junit.org/forum/16, I'm posting to   Message List  
Reply Message #21472 of 23897 |
Re: [junit] Support of jUnit 4 annotations in jUnit-3-style TestCases

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



Thu Apr 2, 2009 2:14 pm

dsaff
Offline Offline
Send Email Send Email

Message #21472 of 23897 |
Expand Messages Author Sort by Date

Hello, as advised on http://www.junit.org/forum/16, I'm posting to this list the following problem - in summary, jUnit4 annotations are ignored by jUnit 4...
jduprez4junit Offline Send Email Mar 31, 2009
11:09 am

J, If your test class extends TestCase, then the 3.8 rules are applied exactly. There are still lots of tools that depend fairly strongly on that guarantee....
David Saff
dsaff Offline Send Email
Mar 31, 2009
1:52 pm

[renamed topic with a more appropriate subject line] OK I understand this is an intentional feature, and that it would be costly to change it. It's not a...
jduprez4junit Offline Send Email Mar 31, 2009
4:44 pm

... If you annotate OrderDaoTestCase with @RunWith(JUnit4.class), does everything work? David Saff ... As you've gathered, we've been relying on Google and the...
David Saff
dsaff Offline Send Email
Apr 2, 2009
2:15 pm
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help