Home > Before and After annotation example

TestNG: Use of Before and After annotations with sample code

Exmaples for @BeforeMethod and @AfterMethod in TestNG. @BeforeMethod allows the method to execute before the execution of each Test methods, whereas @afterMethod is executed after the execution of each Test methods.  [crayon-6737153881c5c384523640/] Output: First Method:Before Method starts!Test with Default priorityAfter Method starts In the above output, we can observe for every Test first @BeforeMethod is

This Article is TAGGED in , , , , , . Read more