TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

TestNG @AfterSuite Annotation

TestNG @AfterSuite Annotation with Testng Tutorial, Introduction, Testng Installation, Features of Testng, Suite Test, Testng Exception Test, Group Test, Plug with Ant, Plug with Eclipse, etc.

<< Back to TESTNG

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

package com.TheDeveloperBlog;
import org.testng.annotations.Test;
public class Module1 
{
 @Test
 public void a_test()
 {
	 System.out.println("Test1");
 }
 @Test
 public void b_test()
 {
	 System.out.println("Test2");
 }
}

Module2.java

package com.TheDeveloperBlog;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.Test;
public class Module2 
{
@AfterSuite
public void after_suite()
{
	System.out.println("Last method");
	
}
@Test
public void c_test()
{
	System.out.println("Test3");
}
}

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




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf