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

@BeforeSuite method is run intermittently #2038

Closed
1 of 7 tasks
nshustov opened this issue Mar 20, 2019 · 4 comments
Closed
1 of 7 tasks

@BeforeSuite method is run intermittently #2038

nshustov opened this issue Mar 20, 2019 · 4 comments

Comments

@nshustov
Copy link

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?

  • Shell
  • Maven
  • Gradle
  • Ant
  • Eclipse
  • IntelliJ
  • NetBeans

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.xml

What fixed the problem was specifying two included files explicitly:

config-one.xml config-two.xml

Hope this will spare somebody from the same PITA I had.

@krmahadevan
Copy link
Member

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

@nshustov
Copy link
Author

nshustov commented Mar 21, 2019 via email

@juherr
Copy link
Member

juherr commented Mar 24, 2019

@nshustov How can you expect a fix if you can't update a library? :)

BTW, we only support one branch and so fixes are only done on the latest version.

If you still have the issue with the latest 7.x version, please provide a sample we can use to reproduce the issue.

@krmahadevan
Copy link
Member

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.

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

No branches or pull requests

3 participants