Actually, JUnit tests do run in a simple and predictable order
(especially when a test class provides its own suite).  I agree that
it's a bad idea to write tests that depend on their ordering, but it
should not be the build system that enforces this (especially when the
XML report is the only way to determine what order surefire used) unless
it's through a property that explicitly tells it to do so.
 
..David..

________________________________

From: David Sag [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 16, 2005 7:32 AM
To: Maven Users List
Subject: Re: Surefires test order



JUnit tests never run in a specific order and you are stongly advised
never to depend upon their execution order. 

if it worked for you at all that is just a lucky fluke

Kind regards,
Dave Sag 




  

Jochen Wiedmann <[EMAIL PROTECTED]> wrote on 13-12-2005
16:21:44:

> Hi,
> 
> I have a test suite that depends on a certain order of tests. More
> precisely, a unit test, which looks like
> 
>     public class MyTest extends TestCase {
>         public void testFoo(){ ... }
>         public void testBar(){ ... }
>     }
> 
> assumes, that testFoo() is invoked before testBar(). This works fine,
> when running the tests from within Ant, or Eclipse.
> 
> My impression is, that Surefire doesn't keep this order. Can anyone
> confirm this? I assume, that reordering the methods is intentional?
> However, if so, two questions arise to me:
> 
> - A reordering occurs, both for test classes (which are typically
executed in
>   alphabetical orders by other frameworks), and methods. However, the
reorder
>   doesn't look choosen randomly: It is reproducable.
> 
>   But if the desired effect is to stop the user from assuming a
> certain order, why
>   isn't it random?
> 
> - Would it be possibly to accept a patch, which restores the typical
> order on the users
>   behalf (for example, by setting a property "canonicalOrder")? The
> test suite isn't
>   written by me, and I am almost unable to change it.
> 
> 
> Thanks,
> 
> Jochen
> 
> 
> --
> Often it does seem a pity that Noah and his party did not miss the
> boat. (Mark Twain)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Reply via email to