无法使用pom.xml构建我的Selenium测试

时间:2018-03-09 11:24:22

标签: java maven selenium-webdriver maven-plugin

嗨我是selenium的新手,我试图用maven建立一个测试。我按照pom.xml文件运行/设置maven的一些步骤。我试图更新Maven项目,但仍显示相同的错误。但是,我遇到了一个错误。查看pom.xml文件的详细信息和错误。请帮助我使用Selenium Web,只是想学习。

DataFrame

构建测试时出错:

<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>FAM.Automation.Test</groupId>
  <artifactId>FAM.Automation.Selenium</artifactId>
  <version>0.0.1-SNAPSHOT</version>
    <properties>
    <jre.level>1.8</jre.level>
    <jdk.level>1.8</jdk.level>
    </properties>
  <build>
    <plugins>
    <!-- Compiler plug-in -->
      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <configuration>
      <source>1.8</source>
      <target>1.8</target>
      </configuration>
      <version>3.6.1</version>
      </plugin>

      <!-- Below plug-in is used to execute tests -->
      <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.19.1</version>
      <configuration>
      <testFailureIgnore>true</testFailureIgnore>

        <suiteXmlFiles>
            <suite name="Suite" parallel="none">
            <test name="Test">
            <classes>
            <class name="Automation.fam.test.GoogleHomePageTitle"/>
            </classes>
            </test> <!-- Test -->
            </suite> <!-- Suite -->
            <!-- TestNG suite XML files -->
            <suiteXmlFile>testng.xml</suiteXmlFile>
         </suiteXmlFiles>
        </configuration>
        </plugin>
        </plugins>
    </build>


  <dependencies>
  <dependency>
       <groupId>org.seleniumhq.selenium</groupId>
       <artifactId>selenium-java</artifactId>
       <version>2.53.1</version>
</dependency>

 <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8.8</version>
 </dependency>

 <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
 </dependency>
  </dependencies>
</project>

1 个答案:

答案 0 :(得分:0)

suiteXmlFiles: Basic element 'suite' must not contain child elements

我认为你不应该使用 <suite ...<suiteXmlFiles>

使用<suiteXmlFiles>包含文件。 参考: http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html