testng annotation order code example

Example: annotations order in testng

BeforeClass -> runs first, 
BeforeMethod -> runs second, right before that actual test
Test --> runs after the before method
AfterMethod --> runs after every test method
AfterClass --> runs after all the test method and aftermethod
completed, just one time
--------
@BeforeSuite: The annotated method will be run before all
tests in this suite have run.
@AfterSuite: The annotated method will be run after all tests
in this suite have run.
@BeforeGroups: The list of groups that this configuration
method will run before. This method is guaranteed to run
shortly before the first test method that belongs to any of
these groups is invoked.
@AfterGroups: The list of groups that this configuration
method will run after. This method is guaranteed to run
shortly after the last test method that belongs to any of these
groups is invoked.

Tags:

Misc Example