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

问题描述 投票:0回答:1

无法使用以下命令运行单个测试:mvn -Dtest = SettingsTest #test * 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.khml:

<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中有什么问题或设置有问题吗?

maven testng pom.xml
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.