eclipse - 在 Eclipse : Could not find or load main class org. testng.remote.RemoteTestNG

标签 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

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

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

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

我试过的

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

最佳答案

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

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

关于eclipse - 在 Eclipse : Could not find or load main class org. testng.remote.RemoteTestNG,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59418672/

相关文章:

java - 资源警告java

android - 应用程序无法识别非安卓 jar 中的功能

java - startActivityForResult(Intent, int) 整数参数的目的是什么

java - 为什么控制台窗口仍然输出 'UnhandledAlertException'?

java - 使用 TestNG 编程逻辑

java - Java 中可以同步测试方法吗?

java - Servlet 给出 404 而不是加载适当的页面。控制台在启动 Tomcat 时显示严重错误

c - Raspberry PI 2 - 如何获取 c 程序的文件访问权限以写入光盘

java - TestNG:没有参数的测试方法

java - 在 @AfterMethod 中的 TestNG 中,我如何知道测试结果?