Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

State some commonly used TestNG annotations?

Category: TestNG

@Test – @Test annotation marks a method as a test method.
@BeforeSuite – The annotated method will run only once before all tests in this suite have run.
@AfterSuite – The annotated method will run only once after all tests in this suite have run.
@BeforeClass – The annotated method will run only once before the first test method in the current class is invoked.
@AfterClass – The annotated method will run only once after all the test methods in the current class have been run.
@BeforeTest – The annotated method will run before any test method belonging to the classes inside the tag is run.
@AfterTest – The annotated method will run after all the test methods belonging to the classes inside the tag have run.
@BeforeMethod – The annotated method will run before each test method marked by @Test annotation.
@AfterMethod – The annotated method will run after each test method marked by @Test annotation.
@DataProvider – The @DataProvider annotation is used to pass test data to the test method.
The test method will run as per the number of rows of data passed via the data provider method.

Leave a Reply

Your email address will not be published. Required fields are marked *