-
Notifications
You must be signed in to change notification settings - Fork 1k
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
BUG: Parameter alwaysRun=true for before-methods forces execution of those methods #1622
Comments
Thanks for the report. How do you run the class? Then, there are 2 interpretations:
Related to #1574 |
no group is no group.
(package qa.ok.testng.* contains only one class "AlwaysRunTests" listed in my prev. comment) |
I reword:
Your current suite will run all tests in the package, right? BTW, it is debatable and we can only quick fix regression for the moment. |
Yes. I understand. You mean my tests-list can also have some tests with groups so this can be the reason why Before-methods invoked.
So first is about groups (always run regardless on group) and second - about failed/skipped (alwaysRun regardless on failed/skipped). But currently 'alwaysRun' for before-methods includes behavior for after-methods:
|
I've found this bug was introduced in testng-6.9.5 when fixing #420
|
Ok, thanks for digging 👍 |
@juherr - I am not sure how to go about fixing this because : I am not able to figure out how to determine if the user ran with group filtering or if the user ran tests as is. The reason I say this is because a user may have applied a method selector (either as implementation or as a beanshell expression) to filter methods. So if I cannot determine if the tests are being run by applying groups, I will not be able to determine if |
Guys, sorry but I just want to prevent breaking changes in testng, so will try to explain my opinion:
Last note is very impotent. It means: even when if you force to execute I think this behavior ( v6.9.5) should be saved because it was well-designed by @cbeust and it have meaning. There are no reasonable situations in testing when you should continue to execute 'child' prerequisites after 'parent' failed. @krmahadevan, If I understand properly from PR 9d5e6d7, you want to force execution for before-methods only when Finally: |
@kool79 It looks you have a good knowledge of the issue. Maybe you can propose a pull request with the fix? |
Sorry.. by mistake clicked the wrong button. |
+1, our team affected by this issue. |
any workaround for this issue? |
@hg0605 - No there aren't any workarounds for this issue at the moment. |
Any update on this? We want to terminate the suite at the BeforeSuite level, but are noticing all the beforeMethods are still running. |
I just ran into this too. I have the exact same use case where I have a |
TestNG Version
Expected behavior
According to official documentation parameter 'alwaysRun' for before-methods is used only to enable/disable filtering by groups. It must not force method execution if higher-level configuration(s) failed.
In any case alwaysRun should not be used both for filtering and for execution forcing
Actual behavior
BeforeTest/BeforeClass/BeforeMethod with (alwaysRun = true) is executed when higher - level configuration failed (BeforeSuite/BeforeTest/BeforeClass)
Is the issue reproductible on runner?
Test case sample
Console output (stacktraces truncated):
The text was updated successfully, but these errors were encountered: