TestNG is an open source automated testing framework. TestNG is similar to JUnit but it is much more powerful than JUnit with advanced annotations.
Advantages of TestNG :
Test cases can be Grouped & Prioritized more easily.
Test that your code is multithread safe.
Using XML do Flexible test configuration.
Support for data-driven testing (with @DataProvider).
Parallel testing is possible.
Compatibility testing (Browsers specific)
Auto-Report Generation (HTML).
Supported ignore, time, parameters, Suite and exception Test.
Supported by Eclipse, IDEA, Ant, Maven, Netbean, Jenkins, Hudson and so on.
Annotations in TestNG :
@BeforeSuite: Method marked with @BeforeSuite annotation will run before the all suites from test.
@AfterSuite: @AfterSuite annotated method will start running when execution of all tests executed from current test suite.
@BeforeTest: @BeforeTest annotated method will be executed before the any @Test annotated method of those classes which are inside <test> tag in testng.xml file.
@AfterTest: @AfterTest annotated method will be executed when all @Test annotated methods completes its execution of those classes which are inside <test> tag in testng.xml file.
@BeforeGroups: @BeforeGroups annotated method will run before the first test run of that specific group.
@AfterGroups: @AfterGroups annotated method will run after all test methods of that group completes its execution.
@BeforeClass: Method annotated using @BeforeClass will be executed before first @Test method execution. @BeforeClass annotated method will be executed once only per class so don’t be confused.
@AfterClass: Method annotated with @AfterClass annotation will be executed once only per class after execution of all @Test annotated methods of that class.
@BeforeMethod: Any method which is marked with @BeforeMethod annotation will be executed before each and every @test annotated method.
@AfterMethod: If any method is annotated with @AfterMethod annotation then it will be executed after execution of each and every @test annotated method.
@Test: @Test annotation describes method as a test method or part of your test.
Install TestNG Eclipse plug-in
How to install TestNG plug-in can be found here