TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

TestNG Annotations

TestNG Annotations with Testng Tutorial, Introduction, Testng Installation, Features of Testng, Suite Test, Testng Exception Test, Group Test, Plug with Ant, Plug with Eclipse, etc.

<< Back to TESTNG

What is TestNG Annotation?

TestNG Annotation is a piece of code which is inserted inside a program or business logic used to control the flow of execution of test methods.

List of TestNG Annotations

TestNG Annotations
TestNG Annotation Description
@BeforeSuite The @BeforeSuite annotated method will run before the execution of all the test methods in the suite.
@AfterSuite The @AfterSuite annotated method will run after the execution of all the test methods in the suite.
@BeforeTest The @BeforeTest annotated method will be executed before the execution of all the test methods of available classes belonging to that folder.
@AfterTest The @AfterTest annotated method will be executed after the execution of all the test methods of available classes belonging to that folder.
@BeforeClass The @BeforeClass annotated method will be executed before the first method of the current class is invoked.
@AfterClass The @AfterClass annotated method will be invoked after the execution of all the test methods of the current class.
@BeforeMethod The @BeforeMethod annotated method will be executed before each test method will run.
@AfterMethod The @AfterMethod annotated method will run after the execution of each test method.
@BeforeGroups The @BeforeGroups annotated method run only once for a group before the execution of all test cases belonging to that group.
@AfterGroups The @AfterGroups annotated method run only once for a group after the execution of all test cases belonging to that group.

Hierarchy of the TestNG Annotations:

TestNG Annotations
  • @BeforeSuite
  • @BeforeTest
  • @BeforeClass
  • @BeforeMethod
  • @Test
  • @AfterMethod
  • @AfterClass
  • @AfterTest
  • @AfterSuite

Benefits of using TestNG Annotations:

  • TestNG Annotations made the life of testers very easy. Based on your requirements, you can access the test methods, i.e., it has no predefined pattern or format.
  • You can pass the additional parameters to TestNG annotations.
  • In the case of TestNG annotations, you do not need to extend any test classes.
  • TestNG Annotations are strongly typed, i.e., errors are detected at the compile time.





Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf