What is TestNG ? | Benefits | Annotations in TestNG

 


What is TestNG

TestNG stands for Test Next Generation. This is the next generation testing framework created with the help of TestNG libraries. As in traditional testing we have some limitation. Thus TestNG provides following benefits:
  • No need to write test codes repeatedly for some repeating task
  • We can have our own easy test reports to learn about the test success and failures
  • Can run multiple test class in SUITE for parallel cross browser test
  • Cant create our own database for testing, etc.

Annotation in TestNG

TestNG consist of various annotations which hold specific predefined properties. Following are the annotations and their properties for your easy understanding 
  • @Test                  > This indicate the starting point of a Test. Each new @Test signifies as the new test 
  • @BeforeSuite      > This will rune the code once Before the suite
  • @AfterSuite        > This will rune the code once After the suite 
  • @BeforeTest      > This will rune the code once Before the Test
  • @AfterTest        > This will rune the code once After the Test
  • @BeforeClass     > This will rune the code once before all the methods in a class
  • @AfterClass       > This will rune the code once after all the methods in a class
  • @BeforeMethod > This will rune the code once before each method in class
  • @AfterMethod   > This will rune the code once after each method in class
  • @Database         >  This helps us create our own test data for data driven testing

Comments