lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson (JIRA)" <>
Subject [jira] Commented: (LUCENE-2037) Allow Junit4 tests in our environment.
Date Wed, 18 Nov 2009 01:48:39 GMT


Erick Erickson commented on LUCENE-2037:

Well, it all depend on how you feel about 10 seconds as far as LocalizedTestCase is concerned.

JUnit4 is really not built to run some tests in a class with the @Parameterized notation and
some not, it runs all the tests in the class with all the parameters. In the case of TestQueryParser,
which is the only test class I saw that made use of the "include some tests but not others'
in LocalizedTestCase, I hacked in running all the tests with all the locales available (152
in my case). Which pushes the number of tests in that one class up over 4,000 FWIW.

Running that test case went from around 5 seconds to around 15 seconds on my 2 year old Macbook
Pro, from inside IntelliJ.

I don't think it's worth trying to refactor that class into two classes, one that has all
the tests run with all the locales and one that has the rest of the tests run only with the
default locale (which is how I read the code in LocalizedTestcase) for 10 seconds worth of
time savings. One could emulate the old process of excluding some tests by returning immediately
from those tests that *weren't* intended to be run with all locales if the current locale
wasn't the default, but I don't see that as worth the effort, although I could be convinced
otherwise if people feel strongly.

I'll provide a patch for this if there are no objections later this week, perhaps I'll get
a chance to look at BaseTokenStreamTestCase before then.

This will make LocalizedTestCase obsolete and I'll remove it in the patch.

> Allow Junit4 tests in our environment.
> --------------------------------------
>                 Key: LUCENE-2037
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Other
>    Affects Versions: 3.1
>         Environment: Development
>            Reporter: Erick Erickson
>            Assignee: Erick Erickson
>            Priority: Minor
>             Fix For: 3.1
>         Attachments: junit-4.7.jar, LUCENE-2037.patch
>   Original Estimate: 8h
>  Remaining Estimate: 8h
> Now that we're dropping Java 1.4 compatibility for 3.0, we can incorporate Junit4 in
testing. Junit3 and junit4 tests can coexist, so no tests should have to be rewritten. We
should start this for the 3.1 release so we can get a clean 3.0 out smoothly.
> It's probably worthwhile to convert a small set of tests as an exemplar.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message