lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prad Nelluru <prn...@microsoft.com>
Subject Dealing with randomness in unit tests
Date Mon, 08 Sep 2014 23:59:45 GMT
Hey all,

The Java Lucene code uses a test randomization framework. The framework's random number methods
use a new seed value each time the tests are run. Whenever there's a test failure, the seed
is displayed so the conditions for the failure can be replayed. As there is no equivalent
randomization framework in C#, we currently just use the .net Random class whenever a random
generator is required. Crucially, we don't provide a seed or even record it. As the seeds
can't be known, we have no way of reproducing test failures. While I haven't seen an intermittent
failure yet, I've heard that Russell ran into them occasionally.

We can either use a hardcoded fixed seed, or we can store a random seed to show when a test
fails. In any case, we should remove the initializations of Random all over the place (replacing
them with LuceneTestCase.Random()).

What do you all think?

-Prad

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message