在 Eclipse 中:无法找到或加载主类 org.testng.remote.RemoteTestNG

WW.*_*WW. 5 eclipse testng

配置

我有 Eclipse 的 2019-12 (4.14.0) 版本(最近从 2019-03 升级),并安装了以下插件(其中包括):

TestNG 6.14.3.201902250526
TestNG M2E (Maven) Integration (Optional) 6.14.3.201902250526
TestNG P2 Features 6.14.3.r201802240500
Run Code Online (Sandbox Code Playgroud)

Eclipse 正在针对jdk1.8.0_152.

在 Eclipse 中,我的 Java 构建路径包括testng-6.14.3. 我试图将 Eclipse 插件版本与项目中使用的版本相匹配。

Properties -> TestNG我下面有所有的默认设置。这里没有“使用项目TestNG.jar”的设置。

什么有效

当我使用 Gradle 从命令行运行测试时,它们都顺利通过。

Eclipse 中没有显示编译错误。

什么不起作用

当我从 Eclipse 运行测试(通过右键单击一个类)时,控制台显示:

Error: Could not find or load main class org.testng.remote.RemoteTestNG
Run Code Online (Sandbox Code Playgroud)

看来我需要一份testng-remote.jar. 它应该作为插件的一部分安装,还是我打算将它build.gradle作为依赖项包含在我的插件中?

为什么我不能从 Eclipse 运行测试?我是否需要进一步安装一些东西来解决这个错误?

我试过的

我尝试删除并重新安装 TestNG 插件。

qtx*_*txo 4

看来您在 Windows 中遇到了错误https://bugs.eclipse.org/bugs/show_bug.cgi?id=558495。因此,我将版本恢复到 2019-09。

该错误导致本应位于类路径上的 jar 不在类路径上。这会影响具有长类路径的项目。