how to run all methods one by one in multiple class by setting priority using testng?
public class test1 {
@Test(priority = 1)
public void test1()
{
System.out.println("test1");
}
@Test(priority = 2)
public void test2()
{
System.out.println("test2");
}
}
public class test2 {
@Test(priority = 1)
public void test3()
{
System.out.println("test3");
}
@Test(priority = 2)
public void test4()
{
System.out.println("test4");
}
}
Expected output
test1
test2
test3
test4
but getting
test1
test3
test2
test4
how to run class 1 firs and then class 2?
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="SANITY SUITE">
<test name="TESTCASE1" >
<classes>
<class name="demo.demo.test1"/>
<class name="demo.demo.test2"/>
</classes>
</test>
</suite>