Javatpoint Logo
Javatpoint Logo

TestNG @AfterSuite Annotation

@AfterSuite: The @AfterSuite annotated method is executed after the execution of all the test methods in the Suite. The Suite is basically a testng.xml file so we can say that @AfterSuite annotated method is executed after the execution of an XML file.

The @BeforeSuite annotation is used to set up or start the selenium drivers while the @AfterSuite annotation is used to stop the selenium web drivers.

Let's consider a simple example.

Step 1: Open the Eclipse.

Step 2: We create two java projects, i.e., Module1.java and Module2.java.

Module1.java

Module2.java

Step 3: We create testng.xml file to configure classes.

testng.xml file

Till now, we created two classes, i.e., Module1 and Module2, and then we configure these two classes in the testng.xml file. The @AfterSuite annotated method is defined in Module2 class.

Step 4: Run the testng.xml file. Right click on the testng.xml file and then move down to Run As and click on 1 TestNG Suite.

Output

TestNG @AfterSuite Annotation
Next TopicTestNG Annotations





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA