order of execution of tests

View: New views
5 Messages — Rating Filter:   Alert me  

order of execution of tests

by Shantaram :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Is there a guarantee that multiple tests in a testng.xml file will be
executed in the order they are declared in the file ?
Assume parallel option is none and no dependson annotations are used.

I have exhaustively tested this and the test are getting executed in
right order.
But wanted a confirmation before my team gets down to writing the
xml's
 eg -- in follopwing example, will method2 always run after method1

<suite name="TESTNG-59 Suite" >
        <test name="TESTNG-1">
                <classes>
                <class name="test.class1">
                        <methods>
                                <include name="method1"/>
                        </methods>
                </class>
                </classes>
        </test>
        <test name="TESTNG-2">
                <classes>
                <class name="test.class2">
                        <methods>
                                <include name="method2"/>
                        </methods>
                </class>
                </classes>
        </test>

</suite>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng-users@...
To unsubscribe from this group, send email to testng-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: order of execution of tests

by Cédric Beust ♔ :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Sun, Nov 8, 2009 at 6:18 AM, shashank ( shantaram ) <svwaingankar@...> wrote:

Is there a guarantee that multiple tests in a testng.xml file will be
executed in the order they are declared in the file ?

No, the XML file only contains the list of classes to be analyzed by TestNG.

If you need a specific ordering, you should use dependsOnGroups/dependsOnMethods.

--
Cédric



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng-users@...
To unsubscribe from this group, send email to testng-users+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Re: order of execution of tests

by Shantaram :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Please suggest how i can implement the following requirement.
I have 3 @test methods A,B and C testing three tasks.

I want to test multiple test flows
eg
test 1  - run A -> run B -> run C
test 2  - run A -> run C -> run B
test 3  - run B -> run C -> run A

I want to write many such flows
I dont mind writing an xml for each flow but i should be able to do it without changing the annotations in the java test code (needing re compiling)


-- 
Regards,

Shantaram Waingankar
9969035764
www.shantaram.co.nr

Twenty years from now you will be more disappointed by the things you didn't do than by the ones you did do. 
So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. 
Explore. Dream. Discover.


2009/11/8 Cédric Beust ♔ <cbeust@...>


On Sun, Nov 8, 2009 at 6:18 AM, shashank ( shantaram ) <svwaingankar@...> wrote:

Is there a guarantee that multiple tests in a testng.xml file will be
executed in the order they are declared in the file ?

No, the XML file only contains the list of classes to be analyzed by TestNG.

If you need a specific ordering, you should use dependsOnGroups/dependsOnMethods.

--
Cédric



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng-users@...
To unsubscribe from this group, send email to testng-users%2Bunsubscribe@...
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---






--

You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng-users@....
To unsubscribe from this group, send email to testng-users+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

Re: Re: order of execution of tests

by Harihara Vinayakaram :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Technically the order of tests in testng.xml can change. But for now in a sequential flow this works .  So you can write your testng.xml as

<test .... >
   <include name="A" />
</test>
<test ...>
    <include name="B" />
</test>

and you can pass the appropriate testng.xml to your TestNG ant task

etc.
But beware that this is not fixed and can change as Cedric mentioned in a post some time back. 

Regards
Hari

On Wed, Nov 25, 2009 at 12:34 PM, Shantaram <svwaingankar@...> wrote:
Please suggest how i can implement the following requirement.
I have 3 @test methods A,B and C testing three tasks.

I want to test multiple test flows
eg
test 1  - run A -> run B -> run C
test 2  - run A -> run C -> run B
test 3  - run B -> run C -> run A

I want to write many such flows
I dont mind writing an xml for each flow but i should be able to do it without changing the annotations in the java test code (needing re compiling)


-- 
Regards,

Shantaram Waingankar
9969035764
www.shantaram.co.nr

Twenty years from now you will be more disappointed by the things you didn't do than by the ones you did do. 
So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. 
Explore. Dream. Discover.


2009/11/8 Cédric Beust ♔ <cbeust@...>


On Sun, Nov 8, 2009 at 6:18 AM, shashank ( shantaram ) <svwaingankar@...> wrote:

Is there a guarantee that multiple tests in a testng.xml file will be
executed in the order they are declared in the file ?

No, the XML file only contains the list of classes to be analyzed by TestNG.

If you need a specific ordering, you should use dependsOnGroups/dependsOnMethods.

--
Cédric



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng-users@...
To unsubscribe from this group, send email to testng-users%2Bunsubscribe@...
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---






--

You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng-users@....
To unsubscribe from this group, send email to testng-users%2Bunsubscribe@....
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--

You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng-users@....
To unsubscribe from this group, send email to testng-users+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

Re: Re: order of execution of tests

by anil raju :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

As a part of our test framework we have multiple test files and some
of the workflows demand to include the tests of a particular suite
into another one and also ensure that the tests of the included suite
files are run in the sequence of inclusion.

On looking up what i see is that the suite-files tag can have multiple
test files and all the tests in them run too. But the sequence of
running the tests is not guaranteed.

A standard testng file with included suites will look like this.
eg.
<suite name="Suite1" verbose="1">
 <suite-files>
             <suite-file path="testng1.xml" />
              <suite-file path="testng2.xml" />
  </suite-files>
<test name="test1">
<classes>
                                <class name="com.abc.test">
                                        <methods>
                                                <include name="test1()" />
                                        </methods>
                                </class>
                        </classes>

<./test>
</suite>

What i want to ensure is that the tests in testng1.xml are run before
testng2.xml and the tests in this file needs to be run at the end. Is
there any existing method which i could use to make the tests run in
this order.

Regards,
Anil


On Wed, Nov 25, 2009 at 1:05 PM, Harihara Vinayakaram <hvram1@...> wrote:

> Technically the order of tests in testng.xml can change. But for now in a
> sequential flow this works .  So you can write your testng.xml as
>
> <test .... >
>    <include name="A" />
> </test>
> <test ...>
>     <include name="B" />
> </test>
>
> and you can pass the appropriate testng.xml to your TestNG ant task
>
> etc.
> But beware that this is not fixed and can change as Cedric mentioned in a
> post some time back.
>
> Regards
> Hari
>
> On Wed, Nov 25, 2009 at 12:34 PM, Shantaram <svwaingankar@...> wrote:
>>
>> Please suggest how i can implement the following requirement.
>> I have 3 @test methods A,B and C testing three tasks.
>> I want to test multiple test flows
>> eg
>> test 1  - run A -> run B -> run C
>> test 2  - run A -> run C -> run B
>> test 3  - run B -> run C -> run A
>> I want to write many such flows
>> I dont mind writing an xml for each flow but i should be able to do it
>> without changing the annotations in the java test code (needing re
>> compiling)
>>
>> --
>> Regards,
>>
>> Shantaram Waingankar
>> 9969035764
>> www.shantaram.co.nr
>>
>> Twenty years from now you will be more disappointed by the things you
>> didn't do than by the ones you did do.
>> So throw off the bowlines. Sail away from the safe harbor. Catch the trade
>> winds in your sails.
>> Explore. Dream. Discover.
>>
>> 2009/11/8 Cédric Beust ♔ <cbeust@...>
>>>
>>>
>>> On Sun, Nov 8, 2009 at 6:18 AM, shashank ( shantaram )
>>> <svwaingankar@...> wrote:
>>>>
>>>> Is there a guarantee that multiple tests in a testng.xml file will be
>>>> executed in the order they are declared in the file ?
>>>
>>> No, the XML file only contains the list of classes to be analyzed by
>>> TestNG.
>>>
>>> If you need a specific ordering, you should use
>>> dependsOnGroups/dependsOnMethods.
>>>
>>> --
>>> Cédric
>>>
>>>
>>>
>>> --~--~---------~--~----~------------~-------~--~----~
>>> You received this message because you are subscribed to the Google Groups
>>> "testng-users" group.
>>> To post to this group, send email to testng-users@...
>>> To unsubscribe from this group, send email to
>>> testng-users+unsubscribe@...
>>> For more options, visit this group at
>>> http://groups.google.com/group/testng-users?hl=en
>>> -~----------~----~----~----~------~----~------~--~---
>>>
>>
>>
>>
>>
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "testng-users" group.
>> To post to this group, send email to testng-users@....
>> To unsubscribe from this group, send email to
>> testng-users+unsubscribe@....
>> For more options, visit this group at
>> http://groups.google.com/group/testng-users?hl=en.
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "testng-users" group.
> To post to this group, send email to testng-users@....
> To unsubscribe from this group, send email to
> testng-users+unsubscribe@....
> For more options, visit this group at
> http://groups.google.com/group/testng-users?hl=en.
>



--
Don't talk unless you can improve the silence.
Visit my blog at
http://anilraju.co.nr

--

You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng-users@....
To unsubscribe from this group, send email to testng-users+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.