Priority in TestNG with multiple classes

后端 未结 6 1004
再見小時候
再見小時候 2020-11-27 20:15

I\'m facing with the following problem: I created two classes which include @Tests with priority attribute:

@Test( priority = 1 )
public void testA1() {
             


        
6条回答
  •  余生分开走
    2020-11-27 21:01

    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.

提交回复
热议问题