【发布时间】:2021-11-25 02:49:21
【问题描述】:
我正在尝试为 Jenkins 中的每个套件设置作业,所有作业都在本地工作 - 但是当尝试从 Jenkins 运行时,它们失败了。我的理解是它与surefire和/或Jenkins的配置有关,但我不确定我缺少什么:
11:08:40 [ERROR]
11:08:40 [ERROR] Please refer to /var/jenkins_home/workspace/AutomatedEmailTests/framework/target/surefire-reports for the individual test results.
11:08:40 [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
11:08:40 [ERROR] There was an error in the forked process
11:08:40 [ERROR] Suite file /framework/TestSuites/AutomatedEmailTests.xml is not a valid file
11:08:40 [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
11:08:40 [ERROR] Suite file /framework/TestSuites/AutomatedEmailTests.xml is not a valid file
11:08:40 [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:657)
11:08:40 [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:283)
11:08:40 [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:246)
11:08:40 [ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1161)
11:08:40 [ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1002)
11:08:40 [ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:848)
11:08:40 [ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
11:08:40 [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
11:08:40 [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
11:08:40 [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
11:08:40 [ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
11:08:40 [ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
11:08:40 [ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
11:08:40 [ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
11:08:40 [ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
11:08:40 [ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
11:08:40 [ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
11:08:40 [ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
11:08:40 [ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
11:08:40 [ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
11:08:40 [ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
11:08:40 [ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
11:08:40 [ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
11:08:40 [ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
11:08:40 [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
11:08:40 [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
11:08:40 [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
11:08:40 [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
波姆:
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId></groupId>
<artifactId>framework</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<testng.files.location>src/TestSuites/</testng.files.location>
<testng.file>testng.xml</testng.file>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<gridUrl></gridUrl>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${SuiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.4.0</version>
<scope>compile</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.7.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.webdriver</groupId>
<artifactId>webdriver-chrome</artifactId>
<version>0.9.7376</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>com.github.stephenc.monte</groupId>
<artifactId>monte-screen-recorder</artifactId>
<version>0.7.7.0</version>
</dependency>
</dependencies>
</project>
我尝试将以下内容添加到目标中以进行故障排除,但没有运气test -Dsurefire.suiteXmlFiles=/framework/TestSuites/AutomatedEmailTests.xml
【问题讨论】:
-
它说“AutomatedEmailTests.xml 不是一个有效的文件”,在 Jenkins 服务器上检查这个文件。
-
Jenkins 服务器每次运行都会拉出最新的合并,文件应该没问题