[ 
https://issues.apache.org/jira/browse/LUCENE-3489?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13121182#comment-13121182
 ] 

Dawid Weiss commented on LUCENE-3489:
-------------------------------------

Thanks. I did go through the code, so I know where the seeds are used and had a 
pretty much good understanding as to why. 

As for the different lifecycle - this is weird, but isn't it a direct 
consequence of subclassing BlockJUnit4ClassRunner and relying on what it 
internally does? This is what's causing the problem (superclass impl. changing 
over time - I think you just hit two different junit versions in that issue). 

Perhaps I was wrong and a custom runner is indeed needed, but if so then I 
still think a single seed (logically) would be fine. A custom runner then:
- collects methods to be executed (per-class)
- initializes the global init seed/ random. This random becomes the initial 
randomness source for everything that follows to make it repeatable.
- shuffles methods,
- execute any @BeforeClass rules (see note below),
- for each selected method (-Dtestmethod limits the selection and acts as a 
filter), repeat test.iter-times (seed changes predictably): {initialize 
per-method starting seed based on the current random, create a new test 
instance, execute}.
- execute any @AfterClass rules

The question how to randomize class-level fixtures could be answered by a 
static utility method that would return the per-class seed using ThreadLocal or 
a thread map updated by the runner. Still predictable and repeatable.

I'll chew a bit on the possibilities and report back tomorrow.
                
> Refactor test classes that use assumeFalse(codec != SimpleText, Memory) to 
> use new annotation and move the expensive methods to separate classes
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-3489
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3489
>             Project: Lucene - Java
>          Issue Type: Test
>          Components: general/test
>    Affects Versions: 4.0
>            Reporter: Uwe Schindler
>             Fix For: 4.0
>
>
> Folloup for LUCENE-3463.
> TODO:
> - Move test-methods that need the new @UseNoMemoryExpensiveCodec annotation 
> to separate classes
> - Eliminate the assumeFalse-calls that check the current codec and disable 
> the test if SimpleText or Memory is used

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to