我设置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不是有效的文件
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配置文件进行结构化
请检查套件xml文件的文件扩展名。
根据您共享的屏幕快照,看起来套房文件名为,POS_TestConfig但您将其称为POS_TestConfig.xml。
POS_TestConfig
POS_TestConfig.xml
请重命名文件系统中的文件以包含.xml扩展名,然后重试。之后,它应该为您工作。
.xml