在maven依赖项(pom.xml)中添加TestNG后,TestNG在selenium中不可用

在maven依赖项(pom.xml)中添加TestNG后,TestNG在selenium中不可用,testng,Testng,我无法在TestNG框架下执行代码。我已经在Eclipse中的scope下添加了依赖项并编写了TestNG。请让我知道如何显示TestNG。我可以使用JUnit执行,但不能使用TestNG <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache

我无法在TestNG框架下执行代码。我已经在Eclipse中的scope下添加了依赖项并编写了TestNG。请让我知道如何显示TestNG。我可以使用JUnit执行,但不能使用TestNG

<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>SignUpAccount</groupId>
        <artifactId>SignUpAccount</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <packaging>jar</packaging>
       <name>SignUpAccount</name>
       <url>http://maven.apache.org</url>
    <properties>
        <project.build.sourceEncoding>UTF8</project.build.sourceEncoding>
    </properties>

    <dependencies>
      <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.14.3</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency> 
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId> selenium-java </artifactId>
            <version>3.141.59</version> 
          </dependency>
    </dependencies>
</project>

4.0.0
注册帐户

安装TestNG插件,然后再试一次,如果从Eclipse运行,仅添加TestNG依赖项将不起作用。

您需要在Eclipse中安装TestNG,然后才能看到TestNG及其注释。有关其安装,请参阅以下链接:

这个问题与硒有什么关系?我遗漏了什么吗?我试图安装TestNG框架来与selenium一起工作很抱歉给你带来困惑,这是我的第一篇文章。谢谢你给我指明了正确的方向。我已经成功地添加了TestNg库,并且我能够以TestNg的形式运行测试!太好了,很高兴帮助你!!如果你喜欢的话,也请投我的一票:)