Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

TestNG Tutorials 38: How to Execute Groups in TestNG without Using TestNG XML

Posted on 02/19/2025 By admin

Hello folks,

In this post, we will see something new related to grouping in TestNG.

When we assign group or groups to test methods in TestNG, to include or exclude groups to run we use TestNG xml. Do you know that we can run groups without TestNG xml and can include, exclude groups easily compare to updation in TestNG xml? Yes, we can do. Let’s see how.

Create some TestNG classes as below:

I created two packages and one class in each package. Each class contains three methods which belong to different groups.

Class “GroupingExample1FromP1” from package “GroupsExamplePackage1”:

Class “GroupingExample1FromP2” from package “GroupsExamplePackage2”:

So we have 6 groups total from both packages. G1FromP1, G2FromP1, G3FromP1, G1FromP2, G2FromP2 and G3FromP2.

Now we will run these groups without creating testng xml. Steps are as follows:

Step 1: Navigate to Run-> Run Configurations:

Step 2: Click on TestNG on Left side of run configuration:

Note : You need to expand TestNG. If you have any existing testng.xml click on that to see next step’s screen. If you do not have any existing testng xml, create any testng xml and then repeat above steps again and click on newly created testng xml left side.

Step 3: Select your project:

Step 4: After selecting project, you will see “Groups” under Run header. Click on radio button of “groups”.

Step 5: Click on “Browse” button, You will see all group names there from all packages of project:

Step 6: Select groups which you want to run and click on Ok button:

Step 7: Click on Apply – > Run :

Output:

You can see methods from selected group run. There is no need to use include or exclude tags. This is very useful while creating scripts, quick run of some group scripts etc to test or debug.

More about TestNG in upcoming posts. Stay tuned.

If you have any doubt, feel free to comment below. If you like my posts, please like, comment, share and subscribe. #ThanksForReading

#HappySelenium

Uncategorized

Post navigation

Previous Post: How To Open Duplicate Tab In Chrome Browser – Selenium WebDriver
Next Post: JsonPath – RestAssured

Related Posts

Hierarchy of Selenium Classes and Interfaces – Make Selenium Easy Uncategorized
December 16, 2017 – Make Selenium Easy Uncategorized
March 5, 2019 – Make Selenium Easy Uncategorized
January 1, 2019 – Make Selenium Easy Uncategorized
Introduction to JSONassert Uncategorized
image – Make Selenium Easy Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark