You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Michel Barakat <bm...@gmail.com> on 2010/01/07 12:23:55 UTC

Running unit tests in a specific order

Hey folks,

I am using the surefire plugin to run through JUnit tests.
I am facing some cross-test dependencies issues and thus would like to
investigate how tests perform when ran in a specific order.

I have tried using the' test' flag, as in:
mvn -Dtest=ATest,BTest,CTest test

However, this does not necessarily execute the tests in the specified
order (eg. CTest is executed before ATest or BTest).
Is it possible to specify a strict order, through which unit tests
should be executed?

Cheers
Michel

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


Re: Running unit tests in a specific order

Posted by Stevo Slavić <ss...@gmail.com>.
Use TestNG, it's @Test
annotation<http://testng.org/doc/documentation-main.html#annotations>has
dependsOnMethods and dependsOnGroups attributes which allow you to
express such test dependencies in tests themselves.

Regards,
Stevo.

On Thu, Jan 7, 2010 at 1:07 PM, Entner Harald <En...@afb.de> wrote:

> Hey Michael,
>
> Afaics there is no way to define the order of tests with the surefire
> plugin. Maybe another plugin could help you.
>
> But IMHO i would suggest to remove the dependencies of your tests. E.g.
> using the  @Before annotation. Otherwise you can never be sure that your
> tests are working after changing one of your dependent tests.
>
> This is more an advice than an useful hint. But i'm pretty sure that the
> surefire plugin itself wont help you defining the order of your tests.
>
> Harald
>
> -----Ursprüngliche Nachricht-----
> Von: Michel Barakat [mailto:bmichel@gmail.com]
> Gesendet: Donnerstag, 7. Januar 2010 12:24
> An: users@maven.apache.org
> Betreff: Running unit tests in a specific order
>
> Hey folks,
>
> I am using the surefire plugin to run through JUnit tests.
> I am facing some cross-test dependencies issues and thus would like to
> investigate how tests perform when ran in a specific order.
>
> I have tried using the' test' flag, as in:
> mvn -Dtest=ATest,BTest,CTest test
>
> However, this does not necessarily execute the tests in the specified
> order (eg. CTest is executed before ATest or BTest).
> Is it possible to specify a strict order, through which unit tests
> should be executed?
>
> Cheers
> Michel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

AW: Running unit tests in a specific order

Posted by Entner Harald <En...@afb.de>.
Hey Michael, 

Afaics there is no way to define the order of tests with the surefire plugin. Maybe another plugin could help you. 

But IMHO i would suggest to remove the dependencies of your tests. E.g. using the  @Before annotation. Otherwise you can never be sure that your tests are working after changing one of your dependent tests. 

This is more an advice than an useful hint. But i'm pretty sure that the surefire plugin itself wont help you defining the order of your tests. 

Harald 

-----Ursprüngliche Nachricht-----
Von: Michel Barakat [mailto:bmichel@gmail.com] 
Gesendet: Donnerstag, 7. Januar 2010 12:24
An: users@maven.apache.org
Betreff: Running unit tests in a specific order

Hey folks,

I am using the surefire plugin to run through JUnit tests.
I am facing some cross-test dependencies issues and thus would like to
investigate how tests perform when ran in a specific order.

I have tried using the' test' flag, as in:
mvn -Dtest=ATest,BTest,CTest test

However, this does not necessarily execute the tests in the specified
order (eg. CTest is executed before ATest or BTest).
Is it possible to specify a strict order, through which unit tests
should be executed?

Cheers
Michel

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


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


Re: Running unit tests in a specific order

Posted by Adam <pu...@gmail.com>.
Couldn't you use a TestSuite to do this?  We use these to run tests in
specified orders.

http://junit.org/apidocs/junit/framework/TestSuite.html

Adam
<http://www.mobilvox.com>


On Thu, Jan 7, 2010 at 9:18 AM, Kumar Ampani <am...@gmail.com> wrote:
> Can these tests in problem run by themselves standalone ?
>
> If so, I am guessing you are running into problem where one test is setting
> the data (like static or threadLocal etc) which is making the other tests to
> fail,
> You can run these tests in problem in a different execution set within the
> surefire plugin.
>
> Thanks
> Kumar
>
> On Thu, Jan 7, 2010 at 6:23 AM, Michel Barakat <bm...@gmail.com> wrote:
>
>> Hey folks,
>>
>> I am using the surefire plugin to run through JUnit tests.
>> I am facing some cross-test dependencies issues and thus would like to
>> investigate how tests perform when ran in a specific order.
>>
>> I have tried using the' test' flag, as in:
>> mvn -Dtest=ATest,BTest,CTest test
>>
>> However, this does not necessarily execute the tests in the specified
>> order (eg. CTest is executed before ATest or BTest).
>> Is it possible to specify a strict order, through which unit tests
>> should be executed?
>>
>> Cheers
>> Michel
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>

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


Re: Running unit tests in a specific order

Posted by Kumar Ampani <am...@gmail.com>.
Can these tests in problem run by themselves standalone ?

If so, I am guessing you are running into problem where one test is setting
the data (like static or threadLocal etc) which is making the other tests to
fail,
You can run these tests in problem in a different execution set within the
surefire plugin.

Thanks
Kumar

On Thu, Jan 7, 2010 at 6:23 AM, Michel Barakat <bm...@gmail.com> wrote:

> Hey folks,
>
> I am using the surefire plugin to run through JUnit tests.
> I am facing some cross-test dependencies issues and thus would like to
> investigate how tests perform when ran in a specific order.
>
> I have tried using the' test' flag, as in:
> mvn -Dtest=ATest,BTest,CTest test
>
> However, this does not necessarily execute the tests in the specified
> order (eg. CTest is executed before ATest or BTest).
> Is it possible to specify a strict order, through which unit tests
> should be executed?
>
> Cheers
> Michel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>