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

parallel=class with static nested classes: Running testng.xml file works. Running class/package causes incorrect ordering #568

Open
3 of 7 tasks
RichMacDonald opened this issue May 3, 2024 · 0 comments

Comments

@RichMacDonald
Copy link

Problem Statement

See prior report at https://groups.google.com/g/testng-users/c/KpPqUAzEVSw
A test project illustrating the problem is at https://github.com/RichMacDonald/testng_parallel_bug_issue_20240503
Using testing 7.10.2. Eclipse plugin version is 7.10.0.202404131040

I have a test class that includes a subclass of itself as a static inner class. So two classes in the same file, one class inheriting from the other.

I run all my tests with 'parallel=classes'. This is specified by an org.testng.ITestNGListener implementation that manually sets the property on the ISuite.

In Eclipse, when I select the class itself and launch testng, there is a single thread that calls @BeforeClass on BOTH classes before calling @BeforeMethod. In other words, the mode is running as 'parallel=methods'. I have verified that the ITestNGListener has been called first. This is the issue.

If I select the package itself and launch testng, the outcome is the same error.

If I select the project's textng.xml file, then it works correctly. With a single thread, all the methods in the first class are executed before the second class is begun.

If I move the static inner class to its own separate file, then everyone works correctly in all modes. Specifically, running testng on all classes in a package now works correctly. whereas it didn't before.

Any relate message in "Error Log" view

"Windows -> Show View -> Others -> Error Log"
None

The Dependency Management tool for your project

  • Maven
  • Gradle
  • Ant
  • Eclipse Buildpath (aka. Use "TestNG Library" for your project in Eclipse)

Operating System

  • Windows
  • Linux
  • OSX
@RichMacDonald RichMacDonald changed the title parallel=class with static nested classes: Running project textng.xml file works. Running class package causes incorrect ordering parallel=class with static nested classes: Running testng.xml file works. Running class/package causes incorrect ordering May 3, 2024
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

No branches or pull requests

1 participant