How exactly do I control whether maven-surefire-plugin uses TestNG
or JUnit? It looks like all I need to do is change the dependency
in the pom.xml from junit:junit to org.testng:testng. I did that,
and fixed up a few problems it uncovered, but I can't tell from the
output whether it's using TestNG or not. Plus, it seems to be
executing the test *files* in the same order each time, even if I
specify <runOrder>random</runOrder> (and upgrade to the 2.7 version
of maven-surefire-plugin).
Can you get this to work and show me how you did it, even for a single
GlassFish module?
Koper, Dies wrote on 02/26/12 20:02:
> 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.
>
>