Test method priorities in TestNG executing all methods with priority 1 in different classes

1,668 views
Skip to first unread message

JT_selenium

unread,
Aug 3, 2011, 5:20:14 PM8/3/11
to testng-users
Hello All,
I have my testng.xml defined as below.
<suite name="test">
<test name="tests" annotations="JDK">
<classes>
<class name="T1"/>
<class name="T2"/>
</classes>
</test>
</suite>

T1 has method
aa with testng priority 1
bb with testng priority 2

T2 has method
cc with testng priority 1
dd with testng priority 2

On executing this xml, testng executes all methods in different
classes with testng priority 1 followed by prioerity 2. Is there any
way with same xml if all methods of T1 execute first followed by T2.

thanks for help in advance.
Jay

Cédric Beust ♔

unread,
Aug 3, 2011, 6:01:23 PM8/3/11
to testng...@googlegroups.com
Priorities are global to the <test> tag, so put your classes in different <test> tags.

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


Srinivas

unread,
Jul 10, 2013, 4:59:39 AM7/10/13
to testng...@googlegroups.com


Hi Jay,

If you need to execute all methods of T1 first followed by all methods of T2 , add the Attribute preserve-order="true"   to the "test" tag (in which all the different classes are kept together) in XML file . Ex:-
<suite name="test">
<test name="tests" preserve-order="true">
<classes>
<class name="T1"/>
<class name="T2"/>
</classes>
</test>
</suite>

Regards
Srinivas
Reply all
Reply to author
Forward
0 new messages