2016-09-26 47 views
0

@Test(組= { 「初始化」}) 公共correctVM(){}dependsOnGroups註釋試驗NG

@Test(組= { 「初始化」}) 公共serverStartedOk(){}

@Test(dependsOnGroups = {「INIT。*}) 公共方法1(){}

//上述TestNG的代碼

在方法1

,對於使用正則表達式的dependsOnGroups。它是強制性的,以使用regEx還是可以給予的e「init」,因爲所有組的名稱都是init。

回答

0

只有當您使用正則表達式時TestNG才知道您沒有給出絕對組名稱,但是您指示了一個模式。 所以你的榜樣去,你會需要提及

@Test(dependsOnGroups = { "init.* }) 
public method1() { 
    //code goes here. 
} 

爲TestNG的基本上拿起名稱開頭init

任何組