TestNG Annotations and Their Meaning

@BeforeSuite: The annotated method runs before all tests in this suite.

@BeforeTest: The annotated method runs before test classes.

@BeforeGroups: The annotated method runs before the group's tests.

@BeforeClass: The annotated method runs before the first test method which belongs to any of the test groups.

@BeforeMethod: The annotated method runs before each test method.

@Test: The annotated method is a test method. It executes the test.

@AfterMethod: The annotated method runs after each test method.

@AfterClass: The annotated method runs after all the test methods in the current test class.

@AfterGroups: The annotated method runs after the last test method which belongs to any of the test groups.

@AfterTest: The annotated method runs after test classes.

@AfterSuite: The annotated method runs after all tests.

Comments