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



嗨,我是硒的新手,我正在尝试使用 maven 构建测试。我遵循了一些步骤通过pom.xml文件运行/设置maven。我尝试更新Maven项目,但仍然显示相同的错误。但是,我遇到错误。查看 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>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>

构建测试时出错:

[INFO] Scanning for projects...
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building FAM.Automation.Selenium 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ FAM.Automation.Selenium ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) @ FAM.Automation.Selenium ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ FAM.Automation.Selenium ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) @ FAM.Automation.Selenium ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ FAM.Automation.Selenium ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.201 s
[INFO] Finished at: 2018-03-09T19:02:34+08:00
[INFO] Final Memory: 11M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project FAM.Automation.Selenium: Unable to parse configuration of mojo org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test for parameter suiteXmlFiles: Basic element 'suite' must not contain child elements -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginConfigurationException

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

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

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

最新更新