我设置Jenkins启动我的Selenium / TestNG测试。 Jenkins构建成功,但在控制台输出中出现以下错误:
Jenkins控制台输出错误
分叉过程中出错 套件文件/Users/chrisrhoads/IdeaProjects/SikuliScript_POS/POS_TestConfig.xml不是有效文件 org.apache.maven.surefire.booter.SurefireBooterForkException:分叉进程中出错 套件文件/Users/chrisrhoads/IdeaProjects/SikuliScript_POS/POS_TestConfig.xml不是有效文件
POM文件的内容如下。
<?xml version="1.0" encoding="UTF-8"?>
<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>com.POC</groupId>
<artifactId>SikuliScript_POS</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>sonatype-ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
<suiteXmlFiles>
<suiteXmlFile>${project.basedir}/POS_TestConfig.xml</suiteXmlFile>
</suiteXmlFiles>
<properties>
<property>
<outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
<name>surefire.testng.verbose</name>
<value>10</value>
</property>
</properties>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.6</version>
<configuration>
<outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.20</version>
</plugin>
</plugins>
</reporting>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>2.20</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>2.20</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>3.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>21.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
</dependency>
<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulixapi</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulixapi</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
</project>
XML文件内容在这里,据我所知,它没有任何问题。
<suite name="POS_TEST_SUITE" >
<test name="POS_GENERATE_SALES" >
<classes>
<class name="pos_tests.userPlacesEatInOrderTest" />
<methods>
<include name="userOpensRibTest" />
<include name="posOrderTest" />
</methods>
</classes>
</test>
</suite>
该项目使用名为POS_TestConfig.xml的基目录中的TestNG.xml配置文件构建
答案 0 :(得分:2)
请检查套件xml文件的文件扩展名。
根据您分享的屏幕截图,您的套件文件名似乎为POS_TestConfig
,但您将其称为POS_TestConfig.xml
。
请重命名文件系统中的文件以包含.xml
扩展名,然后重试。之后,它应该适合你。