dev@glassfish.java.net

RE: randomize junit test order

From: Koper, Dies <diesk_at_fast.au.fujitsu.com>
Date: Mon, 27 Feb 2012 15:02:42 +1100

TestNG runs tests in random order by default. TestNG can also run JUnit
tests.
I haven't tried, but if you are considering other tools or plug-ins, you
may want to try out TestNG and see if it runs the JUnit tests in random
order.
If it does, it least you'll be adding support for a commonly used and
well supported test library (as supposed to a less-known plug-in). And
no need to modify any tests.

HTH,
Dies


> -----Original Message-----
> From: Bill Shannon [mailto:bill.shannon_at_oracle.com]
> Sent: Sunday, 26 February 2012 11:24 AM
> To: dev_at_glassfish.java.net
> Subject: Re: randomize junit test order
>
> Bobby Bissett wrote on 02/25/2012 03:34 PM:
> > On Sat, Feb 25, 2012 at 6:16 PM, Andreas
> Loew<Andreas.Loew_at_oracle.com> wrote:
> >>
> >> Base line: IMO, you must fix the test and remove the state
dependency
> >> between its methods [...]
> >
> > I think that's *exactly* what Bill wants to do. Running the tests in
> > random order could tell us which tests need to be fixed.
>
> Yup.
>
> > Frankly, if junit tests are really supposed to be order-independent,
> > junit ought to randomize them by default so people can't easily
write
> > buggy tests.
>
> I agree.