Original link: https: //www.yiibai.com/testng/basic-annotations.html
The following is a list of comments TestNG support of:
annotation | description |
---|---|
@BeforeSuite |
In all the tests before the method of the suite are running in the comments, and run only once. |
@AfterSuite |
After all the tests in the suite runs annotation method, run only once. |
@BeforeClass |
Before calling the first test run method of the current class, annotation method to run only once. |
@AfterClass |
After calling the first test run method of the current class, annotation method to run only once |
@BeforeTest |
Annotation method belonging to <test> run until all the test methods in the class label run. |
@AfterTest |
Annotation method belonging to <test> run after all the test methods in the class label run. |
@BeforeGroups |
Configuration list before running the group. This approach ensures that belong to the call shortly before the first one to run any test methods of these groups. |
@AfterGroups |
This configuration will run after the group list. This method ensures operation shortly after the call to belong to any final test of these groups. |
@BeforeMethod |
Annotation methods will run before each test method. |
@AfterMethod |
Notes method will run after each test method. |
@DataProvider |
A method for providing data labeled test methods. Note must return a method Object [] [] in which each Object [] can be assigned to the parameter list of test methods. From the DataProvider received data @Test requires the use of this name is equal annotation dataProvider name. |
@Factory |
The method for marking a factory, the return TestNG will be used to test an object class. The method must return Object [] . |
@Listeners |
Listener on defined test class. |
@Parameters |
It describes how to pass parameters to @Test methods. |
@Test |
The method of labeling a class or as part of the test. |