Lets go to JUnit 4 if possible...

Does it provide method level testing?  (i.e. one doesn't need to
execute every test method just to check the results of one method)

On Thu, Feb 25, 2010 at 8:15 PM, Shai Erera <ser...@gmail.com> wrote:
> Ok this seems a discussion related to JUnit 4, so I'll port what I've said
> about it from the other thread (doing the code cleanup):
>
> {quote}
> Erik, I'm totally with you on JUnit 4. I think the @Test annotation is
> really not a big deal (it's actually very easy to migrate all the current
> tests to JUnit 4 with the added import using some script. Even manually it
> shouldn't be such a big deal.
>
> @Ignore is a perfect other advantage of JUnit4. I've found some tests which
> were prefixed with _, i.e. _testXYZ just to disable them. Nobody knows about
> them until he looks at the code (and pays attention). @Ignore would have
> been better.
>
> And there are lots of other advantages, like the @Before and @After (not
> only class). Another problem I've found in the tests is that not all
> extended LuceneTestCase, and usually their setUp and tearDown
> implementations were wrong - not calling super first/last. When I moved them
> to extend LuceneTestCase they broke (I fixed them, don't worry). However,
> that could never happen if the super's methods were tagged w/ @Before/After,
> because JUnit would take care running them before/after their sub-classes'
> @Before/After. So that's another win for JUnit4.
>
> And of course the @Before/AfterClass are really great !
> {quote}
>
> I think the @Before/After annotations can be a real win for our tests.
>
> My two cents,
> Shai
>
> On Fri, Feb 26, 2010 at 4:57 AM, Erick Erickson <erickerick...@gmail.com>
> wrote:
>>
>> Well, "Things got busy (tm)". Uwe's point if valid; unless there's
>> demonstrable gain, moving things to Junit4 "just for fun" is wasted motion,
>> indeed dangerous. I was focusing on LocalizedTestCase to understand the
>> place of runBare etc. in the scheme of things since when I created
>> LuceneTestCaseJ4 that was something I wanted to figure out to make it a
>> replacement for LuceneTestCase.
>>
>> I can't point to a compelling reason to shake up the code, the only
>> improvement it would have is having a demonstration of using the Junit4
>> @RunWith annotation for future reference.
>>
>> So, I've no compelling reason to push that patch forward. If y'all think
>> it's worth it I'll be happy to crank that patch back up again, it'll take a
>> few days though. It does affect a several files, and if the main value here
>> is an exemplar of the @RunWith annotation, perhaps there's a better place to
>> put that in.
>>
>> Erick
>>
>> On Thu, Feb 25, 2010 at 9:06 PM, Robert Muir <rcm...@gmail.com> wrote:
>>>
>>>
>>>>
>>>> LocalizedTestCase called runBare in LuceneTestCase which reported the
>>>> seed value if an exception was thrown. I couldn't find a good way to access
>>>> runBare or analogs in Junit4, but the interceptor pattern worked as well.
>>>> The interceptor is called by the Junit framework on test events, so there
>>>> aren't references to it in the Lucene test code. There are other places 
>>>> that
>>>> call runBare, so I assumed that if anyone wanted to use Junit4 with those
>>>> classes it would be a good thing to allow.
>>>
>>> I didn't forget about your patch Erick, in my opinion there is nothing
>>> wrong with it. I hope its not discouraging you, the problem is a few of us
>>> have spent countless hours trying to debug this hard-to-reproduce Thai test
>>> failure problem.
>>>
>>> It failed in the existing tests, too, with Junit 3 on hudson (one time!).
>>> At this point, i start to wonder if it could be related to stuff like this:
>>> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6683975
>>>
>>> I don't think we should let this stop progress with the tests, if you
>>> think we should move LocalizedTestCase to junit 4 lets do it.
>>>
>>> --
>>> Robert Muir
>>> rcm...@gmail.com
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to