I\'m facing with the following problem: I created two classes which include @Tests with priority attribute:
@Test( priority = 1 )
public void testA1() {
The most correct way is to use dependsOnMethods.
Priority levels are global for test (don't mix with test-methods which are annotated with @Test). In other words:
when testng runs test (from
tag) it groups methods by priorities and then run it. In your case both testA1 and testB1 have priority=1, so will be executed at the beginning.