无法在项目自动化上执行目标org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test(默认测试):存在测试失败

时间:2019-03-14 17:32:18

标签: maven testng pom.xml

无法使用以下各项运行单个测试:     mvn -Dtest = SettingsTest#test *测试

我已遵循此处提到的步骤:https://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html

它抛出一个错误:

  

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.225 s
[INFO] Finished at: 2019-03-14T11:00:10-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project automation: There are test failures.
[ERROR] 
[ERROR] Please refer to /Users/iOS-automation/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [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/MojoFailureException

我的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.abc</groupId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>automation</name>
  <description>iOS app automation</description>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  </properties>

  <build>
      <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>3.0.0-M3</version>
              <configuration>
				  <suiteXmlFiles>
                      <suiteXmlFile>parth.xml</suiteXmlFile>
                  </suiteXmlFiles>
			  </configuration>
          </plugin>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.5.1</version>
              <configuration>
                  <source>1.8</source>
                  <target>1.8</target>
              </configuration>
          </plugin>
      </plugins>
  </build>
  
  <dependencies>
    <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>2.47.1</version>
	</dependency>
	<dependency>
		<groupId>io.appium</groupId>
		<artifactId>java-client</artifactId>
		<version>4.1.2</version>
	</dependency>
	<dependency>
		<groupId>com.google.code.gson</groupId>
		<artifactId>gson</artifactId>
		<version>2.3.1</version>
	</dependency>
	<dependency>
	  <groupId>org.testng</groupId>
	  <artifactId>testng</artifactId>
	  <version>6.8</version>
      <scope>compile</scope>
	</dependency>
	<dependency>
		<groupId>com.google.googlejavaformat</groupId>
		<artifactId>google-java-format</artifactId>
		<version>1.5</version>
	</dependency>
	  <dependency>
		  <groupId>org.json</groupId>
		  <artifactId>json</artifactId>
		  <version>20180813</version>
	  </dependency>
	  <dependency>
		  <groupId>com.sun.jersey.contribs</groupId>
		  <artifactId>jersey-apache-client</artifactId>
		  <version>1.19.4</version>
	  </dependency>
	  <dependency>
		  <groupId>org.glassfish.jersey.core</groupId>
		  <artifactId>jersey-client</artifactId>
		  <version>2.27</version>
	  </dependency>
  </dependencies>
  <artifactId>automation</artifactId>
</project>

所有其他命令,例如:mvn clean install,mvn clean compile都可以正常工作。

我的pom.xml中是否有问题或设置有问题?

1 个答案:

答案 0 :(得分:0)

您在项目中使用任何插件吗?如以下文章所述,此异常不是来自Maven,而是从插件生成的 https://cwiki.apache.org//confluence/display/MAVEN/MojoFailureException