TestNG Annotations - Part 2

Annotations also play an important role in framework . They guide as to which Class or method will run first and which next. So if we have attached annotations with the peices of code , then these annotations will decide the sequence of run for the Classes and methods etc. 

@Test(enabled=true)
@BeforeSuite
@BeforeTest
@BeforeMethod
@AfterMethod
@AfterTest
@AfterSuite

a critical or explanatory note or body of notes added to a text.

 Extra information associated with a particular point in a document orprogram. Annotations may be added either by a compiler or by theprogrammer. They are not usually essential to the correct function of theprogram but give hints to improve performance. 
2. A new commentary node linked to an existing n



Annotations are often used by frameworks as a way of conveniently applying behaviours to user-defined classes and methods that must otherwise be declared in an external source (such as an XML configuration file) or programmatically (with API calls). The following, for example, is an annotated JPA data class:

The annotations are not method calls and will not, by themselves, do anything. Rather, the class object is passed to the JPA implementation at run-time, which then extracts the annotations to generate an object-relational mapping.



Links to useful posts: