parallel=class with static nested classes: Running testng.xml file works. Running class/package causes incorrect ordering
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Reproduce with the linked testng_parallel_bug_issue_20240503 project, then compare the Eclipse class/package launch path with the testng.xml path. The issue says an ITestNGListener sets parallel=classes on the suite, but class/package launches behave like parallel=methods. Read how the plugin builds the suite for class/package selections versus an XML file, and inspect where nested static classes are collected and ordered. Done means class and package launches honor parallel=classes with the nested class, matching testng.xml behavior.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Java
- Stars
- 198
- Forks
- 163
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from testng-team/testng-eclipse
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
testng-team/testng-eclipse#189 · 1 comment ·
-
Difficulty 3/5 Half a day Newbie friendliness 62/100
testng-team/testng-eclipse#590 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 18/100
testng-team/testng-eclipse#589 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 22/100
testng-team/testng-eclipse#578 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 18/100
testng-team/testng-eclipse#565 · 1 comment ·
All issues in testng-team/testng-eclipse
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
testng-team/testng#3672 ·
Maintainers usually reply within 1 day
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
eclipse-edc/IdentityHub#1296 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
cloudfoundry/uaa#4194 ·
Maintainers usually reply within 1 day
-
area: ui priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
tetsuji16/microProject#1721 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days