TestNG @AfterGroups AnnotationWe have learned about the @BeforeGroups annotation which executes the @BeforeGroups annotated method before the execution of the test methods belonging to the group specified in the parameter of the @BeforeGroups annotation. @AfterGroups: The @AfterGroups annotated method will run only once after the execution of all the test methods of a specified group. Let's understand the @AfterGroups annotation through an example: Step 1: Open the Eclipse. Step 2: We create a simple project. After_groups.java In the above java project, we have created the @AfterGroups annotated method and we pass the "TestingTool" which means that the @AfterGroups annotated method, i.e., after_group() will be invoked after execution of all the test methods belonging to the "Testing tool" group. Step 3: Now, we create a testng.xml file to configure the above class. Step 4: Run the testng.xml file. Right click on the testng.xml file and then move the cursor down to Run As and then click on the 1 TestNG Suite. ![]()
Next TopicTestNG Annotations
|