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

未关闭
#568 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
java
领域
testing

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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
主要语言
Java
星标
198
派生
163
平均合并
4 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

testng-team/testng-eclipse 的其他 Issue

查看 testng-team/testng-eclipse 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。