![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are the annotations in TestNG?
The various annotations available in TestNG are listed below −
@Test – This is used before every test method in the java class file.
@BeforeSuite – This is used to run a particular test method before all the test methods.
@AfterSuite – This is used to run a particular test method after all the test methods.
@BeforeClass – This is used to run a particular test method only once before the first test method.
@AfterClass – This is used to run a particular test method only once after all the test methods in the present java class file are done with execution.
@BeforeTest – This is used to run before any test method inside the @Test tag.
@AfterTest – This is used to run after any test method inside the @Test tag.
@BeforeGroup – This is used to run a test method only once before every test method that belongs to a particular group.
@AfterGroup – This is used to run a test method only once after every test method that belongs to a particular group.
@BeforeMethod – This is used to run a test method before every test method present in that java class file.
@AfterMethod – This is used to run a test method after every test method present in that java class file.