Maven项目中的TestNg类路径设置

时间:2019-03-08 16:06:51

标签: maven selenium-webdriver testng

运行Testng Project时出现此错误

错误:找不到或加载主类org.testng.remote.RemoteTestNG

下面是POM.xml文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.project</groupId>
  <artifactId>WeWalkThru</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <dependencies>
    <!-- https://mvnrepository.com/artifact/org.testng/testng -->


    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.3</version>
        <scope>test</scope>
    </dependency>

        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>      
  </dependencies>
</project>

1 个答案:

答案 0 :(得分:0)

从testng版本6.9.9开始,类RemoteTestNG消失了。您必须升级/降级eclipse testng插件才能解决问题。这是testng maven依赖项和testng eclipse插件的版本兼容性问题。