lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dawid Weiss <>
Subject testclass.getName()
Date Thu, 13 Dec 2012 16:49:19 GMT
Hi Shai,

The old 'getName()' method from LuceneTestCase was returning the
currently executing method name. Note that this is no longer unique
because the same method can run multiple times so you may want to
review your code. In any case, the test class and test "name" are
available from LuceneTestCase via:

   * Return the current class being tested.
  public static Class<?> getTestClass() {
    return classNameRule.getTestClass();

   * Return the name of the currently executing test case.
  public String getTestName() {
    return threadAndTestNameRule.testMethodName;

(getTestClass is static because it is available from static hooks;
getTestName is only available from an instance level).

Note that the returned "test name" may include a seed when repetitions
are used, for example:

testEmpty {#0 seed=[A50E0736D67B6CFF:62B229544428241C]}
testEmpty {#1 seed=[A50E0736D67B6CFF:D6E495A870EAEF30]}
testEmpty {#2 seed=[A50E0736D67B6CFF:580D0374212EA7FB]}
testEmpty {#3 seed=[A50E0736D67B6CFF:69E3A8914DD0FCD2]}
testEmpty {#4 seed=[A50E0736D67B6CFF:25222D3CECD83C69]}
testEmpty {#5 seed=[A50E0736D67B6CFF:B4D8FE6391647169]}
testEmpty {#6 seed=[A50E0736D67B6CFF:8A069AE58354616F]}
testEmpty {#7 seed=[A50E0736D67B6CFF:16B5009FA040F5C1]}
testEmpty {#8 seed=[A50E0736D67B6CFF:2419E5F1D78BE29B]}
testEmpty {#9 seed=[A50E0736D67B6CFF:F392B34BB3DCD5C9]}

so if you're creating filesystem objects with those names then I'd be
careful and do some sanity checking. Better -- I wouldn't use test
name for anything if not really needed. If you need a temporary
folder, use:


depending when you want the scratch dir to be removed, or:



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

View raw message