TestNG注释执行的优先级:
BeforeSuite
BeforeTest
BeforeClass
BeforeGroups
BeforeMethod
测试方法
AfterMethod
AfterGroups
AfterClass
AfterTest
AfterSuite
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterGroups;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeGroups;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class NewTest5 {
@BeforeSuite
public void BeforeSuite(){
System.out.println("BeforeSuite");
}
@AfterSuite
public void AfterSuite(){
System.out.println("AfterSuite");
}
@BeforeTest
public void BeforeTest(){
System.out.println("BeforeTest");
}
@AfterT