【发布时间】:2021-06-28 19:14:37
【问题描述】:
我正在使用 JAVA、MAVEN 和 TESTNG 组合进行测试自动化项目。测试用例在本地环境中运行良好,但 JENKINS 构建遇到以下错误。不确定环境之间缺少什么。
我已经按照互联网的指导更改了 POM 中的一些配置。没有任何效果
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-
test) on project Getter_Web_UI: There are test failures/
[ERROR] Please refer to /var/lib/jenkins/workspace/testING/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] There was an error in the forked process
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:733)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:305)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:265)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1314)
POM.XML
enter code here<?xml version="1.0" encoding="UTF-8"?>
4.0.0
<groupId>org.TESTING</groupId>
<artifactId>TESTING</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<forkCount>3</forkCount>
<reuseForks>true</reuseForks>
<useSystemClassLoader>false</useSystemClassLoader>
<useManifestOnlyJar>false</useManifestOnlyJar>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>4.0.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.30</version>
<scope>test</scope>
</dependency>
</dependencies>
【问题讨论】:
-
正确读取 Surefire 的错误日志。
-
@tibor17 这对我有用,忘记更新答案
-
为什么你有
false 和false ?不推荐。 -
@tibor17 我已经尝试过互联网上提供的任何选项
-
我是 Apache 中 Surefire 的开发人员。您应该了解这些设置。许多人不这样做,然后问题就开始了。您使用这些设置有什么问题吗?
标签: java maven jenkins testng maven-surefire-plugin