Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherited groups should run only for groups selection #2167

Merged
merged 1 commit into from
Oct 13, 2019

Conversation

krmahadevan
Copy link
Member

Closes #2152

When a class is annotated with a “@test” and which
includes one or more groups, and when the test class
has one or more configuration methods, currently
TestNG inherits the groups information and ends
up running all the configurations even though
group filtering is not enabled.

Fixes #2152 .

Did you remember to?

  • Add test case(s)
  • Update CHANGES.txt

We encourage pull requests that:

  • Add new features to TestNG (or)
  • Fix bugs in TestNG

If your pull request involves fixing SonarQube issues then we would suggest that you please discuss this with the
TestNG-dev before you spend time working on it.

Copy link
Member

@juherr juherr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose the previous tests were failing without the changes but I'm afraid of regressions for users too.

Could you check again if we can avoid or minimize the changes?

@krmahadevan
Copy link
Member Author

@juherr

I suppose the previous tests were failing without the changes but I'm afraid of regressions for users too. Could you check again if we can avoid or minimize the changes?

I have tried my level best to keep the impact area to the minimum. The sleuth of tests that had to be changed, was only because they involved groups and now these tests need to be explicitly run in group mode to basically restore the validation that each of the tests are doing. I guess this should be ok.

@krmahadevan
Copy link
Member Author

@juherr - I have fixed the review comments. Please take a look.

@juherr
Copy link
Member

juherr commented Oct 7, 2019

I agree with the change and I think it will be more logic after the fix.
But I'd prefer to let the final decision to @cbeust due to the regression risk.

@cbeust Please, could you check the issue #2152 and review the fix?

@krmahadevan
Copy link
Member Author

Rebased off of master.. @cbeust - Please help provide your inputs.

@juherr
Copy link
Member

juherr commented Oct 7, 2019

Just an idea that will allow the merge without the need of @cbeust approbation:
-> having a configuration to keep the previous behavior (which will be removed in the next major release) and a specific highlight in the changelog for the potential regression (with the tips for having the previous behavior).

We should be safe enough then.

@krmahadevan
Copy link
Member Author

@juherr

having a configuration to keep the previous behavior (which will be removed in the next major release) and a specific highlight in the changelog for the potential regression (with the tips for having the previous behavior).

Am not too excited about a configuration driven approach here for two reasons:

  1. In my opinion this is a bug and is counter intuitive. So why fix a bug with a configuration ?
  2. Its gonna require changes to the unit tests again, because now I will have to isolate the tests and have them sit separately in a configuration driven TestNG object. Not sure I have the bandwidth to go through that exercise.

I will wait to hear back from @cbeust on this.

@krmahadevan
Copy link
Member Author

ping @cbeust

Closes testng-team#2152

When a class is annotated with a “@test” and which
includes one or more groups, and when the test class
has one or more configuration methods, currently 
TestNG inherits the groups information and ends
up running all the configurations even though 
group filtering is not enabled.
@krmahadevan krmahadevan merged commit 194eb64 into testng-team:master Oct 13, 2019
@krmahadevan krmahadevan deleted the fix_2152 branch October 13, 2019 17:45
@mikalai-melnikau
Copy link

mikalai-melnikau commented Dec 5, 2019

@krmahadevan Could we get published a new beta release (like 7.0.1-beta1) with this fix, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple Test Groups Causing @BeforeMethod and @AfterMethod to be called multiple times for a single test
3 participants