Jenkins无法识别生成的诱惑报告xml文件的正确目录
我已经成功地将Allure报告集成到基于maven的testNG项目中,并且能够使用jetty服务器查看该报告。 但现在我正试图按照此处建议的说明,将诱惑报告与詹金斯结合起来- 我现在可以在我的jenkins页面上看到诱惑图标,但是如果我点击这个图标,我会看到404-“未找到页面”错误 我进一步调试控制台输出,并看到异常发生-Jenkins无法识别生成的诱惑报告xml文件的正确目录,jenkins,allure,Jenkins,Allure,我已经成功地将Allure报告集成到基于maven的testNG项目中,并且能够使用jetty服务器查看该报告。 但现在我正试图按照此处建议的说明,将诱惑报告与詹金斯结合起来- 我现在可以在我的jenkins页面上看到诱惑图标,但是如果我点击这个图标,我会看到404-“未找到页面”错误 我进一步调试控制台输出,并看到异常发生- Exception in thread "main" ru.yandex.qatools.allure.data.ReportGenerationException: C
Exception in thread "main" ru.yandex.qatools.allure.data.ReportGenerationException: Could not find any allure results
at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:58)
at ru.yandex.qatools.allure.data.AllureReportGenerator.generate(AllureReportGenerator.java:53)
at ru.yandex.qatools.allure.AllureMain.main(AllureMain.java:48)
Command aborted due to exception {}.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:153)
at ru.yandex.qatools.allure.command.ReportGenerate.runUnsafe(ReportGenerate.java:48)
at ru.yandex.qatools.allure.command.AbstractCommand.run(AbstractCommand.java:52)
at ru.yandex.qatools.allure.CommandLine.main(CommandLine.java:46)
我猜这个错误是因为jenkins无法识别诱惑报告xml的正确目录,为了纠正这个错误,我们必须修改pom.xml,以便它能够告诉jenkins正确目录的路径
有人请告诉我这里缺少什么。您需要从
项目中获取Maven项目到Jenkins的诱惑结果路径。name\target\Allure results
并将其添加到Jenkins\your Job\Configure\Allure Report\Result中
之后,您需要通过以下两种方式之一更改Jenkins安全设置
从以下方面开始Jenkins:
java
-Dhudson.model.DirectoryBrowserSupport.CSP="default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';"
-Djenkins.model.DirectoryBrowserSupport.CSP="default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';"
-jar jenkins.war
通过在中运行这两个脚本
编辑:
我刚刚找到了第三种方法。在Jenkins文件夹中打开Jenkins.XML并添加
-Dhudson.model.DirectoryBrowserSupport.CSP="default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';" -Djenkins.model.DirectoryBrowserSupport.CSP="default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline';"
我喜欢辩论
编辑:
您请求的pom.XML:
<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.siba</groupId>
<artifactId>com.siba.selenium</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>selenium tests</name>
<description>selenium tests</description>
<!-- Change from here -->
<repositories>
<repository>
<id>central</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<packaging>jar</packaging>
<properties>
<aspectj.version>1.7.4</aspectj.version>
<allure.version>1.4.23</allure.version>
</properties>
<dependencies>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-testng-adaptor</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
<configuration>
<testFailureIgnore>false</testFailureIgnore>
<argLine>
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
4.0.0
com.siba
com.siba.selenium
0.0.1-快照
硒测试
硒测试
中心的
垃圾箱
http://jcenter.bintray.com
罐子
1.7.4
1.4.23
ru.yandex.qatools.allure
诱惑测试适配器
${allure.version}
org.testng
testng
6.9.10
测试
org.seleniumhq.selenium
硒爪哇
2.53.0
com.microsoft.sqlserver
sqljdbc4
4
运行时
org.apache.maven.plugins
maven编译器插件
3.5.1
1.8
1.8
org.apache.maven.plugins
maven surefire插件
2.14
假的
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
org.aspectj
aspectjweaver
${aspectj.version}
我终于得到了答案。问题是我的詹金斯配置不在诱惑报告中。我以错误的方式导入了我的项目,因此我的jenkins试图在jenkin的工作区目录中查找报告,但什么都没有
因此,我将maven项目作为自由风格项目重新导入jenkins,并将自定义工作区设置为实际的项目目录。现在一切都正常了。嗯,我已经按照这些步骤进行了尝试,但同样的问题再次出现。实际上,问题是诱惑报告没有被复制到jenkins目录,当我们试图访问它时,它显示404“未找到”错误。我相信问题出在其他地方。你是否能够成功地将詹金斯报告与诱惑报告结合起来。如果是这样的话,你能分享一下你的pom.xml吗?我也有同样的问题,问题不在于maven项目中的诱惑结果。如果你像我建议的那样指出它,它应该工作得很好。我会添加我的pom.XML,但我很确定这不是你的问题。谢谢@Angusiasty,你的pom.XML几乎和我的相似。我尝试了您的pom.xml,但仍然面临相同的问题。我进一步深入研究并找到了原因,在我的projectName/target/allure results direct中生成的名为UniqueId-testsuite.xml的xml文件没有被复制到我jenkins的“workspace”目录中。我尝试将一个旧的“UniqueId testsuite.xml”文件复制到我的jenkins工作区,它在我的jenkins中生成了诱惑报告,但报告显示了旧的执行结果,因为我们使用的是旧的xml。如何将此xml文件复制到jenkins工作区?我根本不复制它。我告诉jenkins在“maven.project\target\allure results”中查找我的结果。使用Freestyle project,我认为我们只能链接通过Ant构建的普通Java应用程序,而不能链接通过maven构建的应用程序。为此,我们需要创建Maven项目,而不是Freestyle项目。在这种情况下,如何解决这个问题?因为我面临同样的问题,我不想创建一个自由泳项目。有人能帮我吗?
<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.siba</groupId>
<artifactId>com.siba.selenium</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>selenium tests</name>
<description>selenium tests</description>
<!-- Change from here -->
<repositories>
<repository>
<id>central</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<packaging>jar</packaging>
<properties>
<aspectj.version>1.7.4</aspectj.version>
<allure.version>1.4.23</allure.version>
</properties>
<dependencies>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-testng-adaptor</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14</version>
<configuration>
<testFailureIgnore>false</testFailureIgnore>
<argLine>
-javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>