Module 9: All you need to know about TestNG


Hi Guys!

It's high time convert our framework to TestNG now.

Right click on project-->TestNG-->Convert to TestNG
This will create a testng.xml at root folder. We will understand and work on it later. Meanwhile, sharing a few annotations you need to get familiar with!

TestNG Annotations

@BeforeSuite: Executes before the execution of all the test methods in the Suite.


@AfterSuite: Executes After the execution of all the test methods in the Suite.


@BeforeTest: Executes before the execution of each and every test in a Class.


@AfterTest: Executes after the execution of each and every test in a Class.


@BeforeClass: Executes before the execution 1st method in current Class.


@AfterClass: Executes after the execution 1st method in current Class.


@BeforeMethod: Executes before the execution of each and every method in a Class.


@AfterMethod: Executes after the execution of each and every method in a Class.


@BeforeGroups: Executes once for a group before the execution of all the test cases included in that group.


@AfterGroups: Executes once for a group after the execution of all the test cases included in that group.

0 comments:

Post a Comment

Thanks a lot for your valuable Comment!