OK, I think I am just going to suck it up and make all our tests JUnit 4 tests. Simpler than adding workarounds just to postpone the time when that happens. Along the way this should hopefully fix all the random issues.
On Wed, Sep 1, 2010 at 9:34 PM, Sean Owen <[email protected]> wrote: > So it looks like the reason some of these tests are failing is due to > variance from random number generation. > > Most tests are old-style JUnit 3 tests and inherit from a base class, > which among other things resets all random number generators > everywhere before every test in setUp(). However some tests are JUnit > 4 tests, and don't (can't) inherit from the same base class (because > then they're run as JUnit 3 tests and any method not starting with > "test" isn't run). So they hit this issue again. > > The stop-gap solution is to put this in any JUnit 4 test: > > �...@before > public void setUp() { > RandomUtils.useTestSeed(); > } > > Really we should gather this into a new superclass for JUnit 4 tests. > But then that superclass should have the same functionality as the > JUnit 3 superclass -- in particular creating and cleaning up temp > files. Copy-n-paste is ugly but works here. > > Any better ideas? > > To avoid two parallel superclasses: > We could merely standardize on JUnit 3, which isn't really backwards, > just different from JUnit 4. > Or move everything forward to JUnit 4, which sounds like a load of > pain (typing @Test 4000 times) but a way forward. >
