You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Laird Nelson <lj...@gmail.com> on 2013/02/12 21:45:26 UTC

maven-surefire-plugin 2.13: test order (know about runOrder)?

Can one control the ordering of test *methods* inside a test class?  I'm
using JUnit 4.11 and Surefire 2.13.

It seems to me from the wording of the runOrder parameter this would be
used to choose what test *classes* to run in what order.

One of our developers is pointing out that Surefire 2.13 seems to have
changed the order that it uses to run methods inside her test class.

While I know and you don't have to tell me that ordering shouldn't be a
property of unit tests, I want to at least understand if it is controllable
or not.

Thanks very much,
Best,
Laird

-- 
http://about.me/lairdnelson

Re: maven-surefire-plugin 2.13: test order (know about runOrder)?

Posted by Laird Nelson <lj...@gmail.com>.
On Tue, Feb 12, 2013 at 2:43 PM, Andreas Gudian <an...@gmail.com>wrote:

> The execution order of the methods within a test class is in control of
> Junit itself.
>

Thanks, Andreas; that explains it.

Best,
Laird
-- 
http://about.me/lairdnelson

Re: maven-surefire-plugin 2.13: test order (know about runOrder)?

Posted by Andreas Gudian <an...@gmail.com>.
Hi Laird,

The execution order of the methods within a test class is in control of
Junit itself.

AFAIK, Junit 4.11 contains a change to order the execution of @Test methods
alphabetically by default. [1] has some information on how to control that
behavior. I think what's now called the "JVM" sorting was the default
behavior in previous versions.

[1]
http://www.hascode.com/2012/11/new-features-in-junit-4-11/#Test_Execution_Order

Cheers,
Andreas

Am Dienstag, 12. Februar 2013 schrieb Laird Nelson :

> Can one control the ordering of test *methods* inside a test class?  I'm
> using JUnit 4.11 and Surefire 2.13.
>
> It seems to me from the wording of the runOrder parameter this would be
> used to choose what test *classes* to run in what order.
>
> One of our developers is pointing out that Surefire 2.13 seems to have
> changed the order that it uses to run methods inside her test class.
>
> While I know and you don't have to tell me that ordering shouldn't be a
> property of unit tests, I want to at least understand if it is controllable
> or not.
>
> Thanks very much,
> Best,
> Laird
>
> --
> http://about.me/lairdnelson
>

Re: maven-surefire-plugin 2.13: test order (know about runOrder)?

Posted by Manfred Moser <ma...@simpligility.com>.
> Can one control the ordering of test *methods* inside a test class?  I'm
> using JUnit 4.11 and Surefire 2.13.
>
> It seems to me from the wording of the runOrder parameter this would be
> used to choose what test *classes* to run in what order.
>
> One of our developers is pointing out that Surefire 2.13 seems to have
> changed the order that it uses to run methods inside her test class.
>
> While I know and you don't have to tell me that ordering shouldn't be a
> property of unit tests, I want to at least understand if it is
> controllable
> or not.

If your test methods depend on the order in which they are executed they
should be refactored to be atomic rather than trying to order them via the
test framework.

manfred

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org