Testng annotations

We write a simplt test in testng using @Test annotation

@Test
public void printmsg(){
System.out.println("Printing msg");
}

Other testng annotations are as follows

@BeforeSuite  //Executed before executing all tests in suite in multiple java files when they are run in batch

@AfterSuite //Executed after executing all tests in suite in multiple java files when they are run in batch

@BeforeMethod //This method will run before every annotation method or test case in java file

@BeforeTest //This method will run before every test or all testcases in java file in general

@AfterMethod //This method will run after every annotation method or test case in java file

@AfterTest //This method will run after every test or all testcases in java file in general