public class TestNGAnnotations {
@BeforeMethod
public void beforeM() {
System.out.println("Before Method");
}
@AfterMethod
public void afterMethod() {
System.out.println("After Method");
}
@BeforeClass
public void beforeCl() {
System.out.println("Before Class");
}
@AfterClass
public void afterCls() {
System.out.println("After Class");
}
//Certain code before each Testname
@BeforeTest
public void beforeT() {
System.out.println("Before Test");
}
@AfterTest
public void afterT() {
System.out.println("after Test");
}
@BeforeSuite
public void beforeSuite() {
System.out.println("before Suite");
}
@AfterSuite
public void afterSuite() {
System.out.println("after Suite");
}
@Test
public void testcase1() {
System.out.println("testcase1");
}
@Test
public void testcase2() {
System.out.println("testcase2");
}
}