RE: Need clarity on Annotations used in testNG?
Below are the few annotations with examples (may not give more info but atleast you will get to know). I will keep you posted once I find all the info.
- @BeforeSuite – DB connection
- @AfterSuite – DB disconnection
- @BeforeTest – Browser initialization and application login
- @AfterTest – Logout and Browser shutdown
- @BeforeMethod – depends
- @AfterMethod – depends
- Groups = Regression, Source code checkin in SVN, GITHUB etc , functional tests
- dependsOnMethods = login–> Homepage
- dependsOnGroups = Regression test case may depends on functional test case group
- @DataProvider = As name suggests, it is used for Parameterization
- @Test(dataProviderClass=DataProvider.class,dataProvider=”dataProviderName”) –> If you create seperate class for all Data proviers then it is the syntax to call them
- enabled = false – To ignore Test
- @Parameters – to get parameters from testng.xml
- Priority = To run the test cases based on priority
Let me know if you need any clarifications on the above so that I will try to answer them.