Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8227871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:16:36+00:00 2026-06-07T16:16:36+00:00

Due to the fact that my setups keeps growing I’d like to use some

  • 0

Due to the fact that my setups keeps growing I’d like to use some more features of TestNG.
So today I tried to exclude a groud in my testng.xml file.

When I declare a whole Class to be part of a group, this doesn’t prevent the constructor to do it’s work (initiating a WebDriver instance).

@Test(groups = "default")
public class ABCDefaultTest extends AbstractABCTest {

    public ABCDefaultTest() {
        super();
    }


}

Please note: AbstractABCTest is part of “abc” group

I thought of quitting the WebDriver in the AfterClass method and added (alwaysRun = true) but that didn’t work.

Seems that the constructor isn’t part of the group (which is good if you have different groups in one class) but the @AfterClass (alwaysRun = true) annotated method is…

But if there’s only the group specified for the class and no partial groups it makes no sense to initiate the class right?

Can you tell me what I’m doing wrong or if this is a bug?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:16:38+00:00Added an answer on June 7, 2026 at 4:16 pm

    Your interpretation is correct, groups only apply to TestNG annotated methods. You should avoid doing work in the constructor that you don’t want to happen if a group is excluded.

    How about doing this work in a @Before* method that belongs to that group? Then you just need to decide which configuration method is appropriate for you: @BeforeSuite, @BeforeTest, @BeforeGroup or @BeforeClass.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed that I rarely use properties, due to the fact that I rarely
can use static methods/ classes safely in WCF due to the fact that WCF
This snippet throws an NullPointerException due to the fact that its unboxed to a
I am having troubles in OpenGL due to the fact that textures have to
I recently installed Oracle's VirtualBox on Ubuntu, due to the fact that I needed
Ok, this was an assignment that I was deducted points due to the fact
To me, I think F# is a bad choice due to the fact that
I have a few repos (for websites) that are growing very large due to
Okay I'm using XHTML1.1 due to the fact that HTML5...doesn't behave as I expect,
Recently, I've started experimenting with Mercurial, due to the fact that it always attracted

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.