Testng is a testing framework inspired by JUnit and NUnit, designed for test configuration flexibility and powerful reporting in Java. Annotations in TestNG control how and when test methods are executed.
Common Testng Annotations
Annotation | Description |
---|---|
@BeforeSuite | Runs once before all tests in the suite |
@AfterSuite | Runs once after all tests in the suite |
@BeforeTest | Runs before <test> tag in TestNG XML file |
@AfterTest | Runs after <test> tag in TestNG XML file |
@BeforeClass | Runs before the first method in the current class |
@AfterClass | Runs after all methods in the current class |
@BeforeMethod | Runs before each @Test method |
@AfterMethod | Runs after each @Test method |
@Test | Marks a method as a test case |
@DataProvider | Provides data for parameterized tests |
@Parameters | Injects parameters from XML into test methods |
@BeforeGroups | Runs before the first method of the specified group |
@AfterGroups | Runs after the last method of the specified group |
No comments:
Post a Comment