java - 错误 : Could not find or load main class org. testng.remote.RemoteTestNG

标签 java eclipse unit-testing testng

我已经使用 TestNG 编写了一个测试套件。我只为我的服务包含了一个 test.java 文件。我也创建了 testng.xml 文件。当我运行 testng.xml 文件时,出现以下错误:

 Error: Could not find or load main class org.testng.remote.RemoteTestNG

请告诉我如何解决这个问题。使用 this 创建测试套件关联。我使用 this 运行套件链接。

编辑: 我的 testng.xml 看起来像:

<suite name="TestAll">
  <test name="testService">
    <classes>
       <class name="com.ui.business.service.impl.myservice.test.MyServiceTest"/>
   </classes>
 </test>
 </suite>

我将 testng.xml 保存在根文件夹中。该项目使用 Maven 编译。我的服务类在 com.ui.business.service.impl.myservice 包中。当我使用“TestNG Suite”运行 testng.xml 时,出现此错误。请建议如何解决此类路径问题。

最佳答案

这对我有用:

  • 右键单击您的项目
  • 点击属性
  • 点击TestNG
  • 取消选中 Use Project TestNG jar
  • 点击应用并关闭

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

相关文章:

java - hadoop mapReduce项目下pom.xml的设置

java - 将链接添加到 MessageDialog 消息

java - 在eclipse中限制tomcat登录

c# - TestContext.Properties 可用吗?

python - 如何向 Nose 提供敏感数据

java - 切换 Activity 时导航栏短暂出现

java - 在 Ubuntu 16 上为所有用户安装 OpenJDK 9

java - 在 TestNG 中注入(inject) WebDrivers @before test with @guice

unit-testing - Reactive Banana 1.0.0 - MomentIO() Monad 中的单元测试

java - 在不使用 Math.pow() 的方法中获取指数