You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For four years had been haunted by the following TestNG problem:
Sometimes TestNG did not run the methods annotated with @BeforeSuite in my test classes.
I tried many things (including reverse engineering TestNG code) but could not find any stable solution.
The fact that it happened quite intermittently did complicated the things.
The most similar problems (with solutions) are described here:
Can you please retry using 7.0.0-beta3 and see if the problem persists? If it does then pls help share a sample that we can use to reproduce the problem
Sorry, I might not be able to try 7.0 it for awhile: this is a commercial
development environment and it is not easy to inject the new library into
it. For the same reason, I do not have a clean cut example that would
demonstrate the issue yet. I will try to make it but cannot promise real
deadline.
No response from user. Please retry using 7.0.0 and if its still a problem, comment with a simple standalone example that can be used to reproduce the issue.
TestNG Version
6.9.4
Expected behavior
@BeforeSuite method is always run
Actual behavior
@BeforeSuite method is run intermittently
Is the issue reproductible on runner?
Test case sample
For four years had been haunted by the following TestNG problem:
Sometimes TestNG did not run the methods annotated with @BeforeSuite in my test classes.
I tried many things (including reverse engineering TestNG code) but could not find any stable solution.
The fact that it happened quite intermittently did complicated the things.
The most similar problems (with solutions) are described here:
https://stackoverflow.com/questions/37538235/beforesuite-not-working
#420
#313
...but none of those were applicable in my case.
Here is the workaround I found.
I do have the abstract base test class that declares @BeforeSuite method, properly annotated with (alwaysRun=true).
The difference and specifics of my case was that I was using an TestNG xml configuration file that included two other configurations:
(testng.xml)
In pom.xml TestNG configuration section I had the single entry referring to this XML file:
testng.xmlWhat fixed the problem was specifying two included files explicitly:
config-one.xml config-two.xmlHope this will spare somebody from the same PITA I had.
The text was updated successfully, but these errors were encountered: