I have 2 TestNG class containing different tests.
For Eg:
Class Test1{
@Test
public void Amazon(){
}
}
Class Test2{
@Test
public void Netflix(){
}
}
In the above example Class Test1 & Test2 are two separate files. Now if you execute the project as "Run as TestNG Test" which one will execute first and why?
Thanks.
The order is not specified by TestNG and may change between TestNG, its plugin or even java version.
But you can imagine it takes classes in the alphabetic order:
If you want a strong order between tests, you have to use one or more order features from TestNG like dependsOnMethods
, priority
, ...
Check the documentation.