Please help me sequence the tests in a Test Suite. I have 2 test classes each having 3 test methods.
First Class
public class FirstClass {
@Test(priority =1)
public void FirstMetod()
{
System.out.println("First Method of First Class");
}
@Test(priority =2)
public void SecondMetod()
{
System.out.println("Second Method of First Class");
}
@Test(priority =3)
public void ThirdMetod()
{
System.out.println("Third Method of First Class");
}
}
Second Class
public class SecondClass {
@Test(priority =1)
public void FirstMetod()
{
System.out.println("First Method of Second Class");
}
@Test(priority =2)
public void SecondMetod()
{
System.out.println("Second Method of Second Class");
}
@Test(priority =3)
public void ThirdMetod()
{
System.out.println("Third Method of Second Class");
}
}
testng.xml
<suite name="Suite">
<test thread-count="5" name="Test">
<classes>
<class name="sample.testng.FirstClass" />
<class name="sample.testng.SecondClass" />
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
The Results are as follows.
First Method of First Class
First Method of Second Class
Second Method of First Class
Second Method of Second Class
Third Method of First Class
Third Method of Second Class
But I need to run the second class after first class. So the desired results should be.
First Method of First Class
Second Method of First Class
Third Method of First Class
First Method of Second Class
Second Method of Second Class
Third Method of Second Class
I have tried grouping and depends on methods also, but could not achieve the desired sequence.
Aucun commentaire:
Enregistrer un commentaire