In this TestNG tutorial we will learn about TestNG Annotations, BeforeGroups, BeforeClass, AfterGroups and AfterClass.
We will understand with example how to use TestNG annotations @BeforeGroups, @AfterGroups @BeforeClass and @AfterClass in your test scripts.
✅ @BeforeClass: The method annotated with @BeforeClass will be executed before the first test method in the current class is invoked.
✅ @AfterClass: The method annotated with @AfterClass will be executed after all the test methods in the current class have been run.
✅ @BeforeGroups: The method annotated with @BeforeGroups is guaranteed to run shortly before the first test method that belongs to any of the groups configured in this method.
✅ @AfterGroups: The method annotated with @AfterGroups is guaranteed to run shortly after the last test method that belongs to any of thee groups configured in this method.