TheDeveloperBlog.com

Home | Contact Us

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

TestNG @AfterGroups Annotation

TestNG @AfterGroups 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 @AfterGroups Annotation

We 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

package com.TheDeveloperBlog;
import org.testng.annotations.AfterGroups;
import org.testng.annotations.Test;
public class After_groups
{
@AfterGroups("Testing tool")
public void after_group()
{
System.out.println("The list which is shown above are the testing tools");
}
@Test(groups= {"Testing tool"})
public void testcase1()
{
System.out.println("Appium");
}
@Test(groups= {"Testing tool"})
public void testcase2()
{
System.out.println("JIRA");
}
@Test(groups= {"Testing tool"})
public void testcase3()
{
System.out.println("RedMine");
}
}

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.

TestNG @AfterGroups 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