TestNG Annotations

In this lesson, we will see some of the annotations that TestNG provides.

List of annotations #

TestNG supports annotations for performing various operations like:

  • @Test annotated method is considered as a test method. This annotation can be added at class level as well. When given at test method level, the one at method level will take precedence. A test method can be disabled by setting @Test(enabled = false). By default, enabled = true.

  • @BeforeSuite annotated method will run once per test suite before all the tests.

  • @AfterSuite annotated method will run once per test suite after all the tests.

  • @BeforeTest annotated method ...