新手区 Jenkins+Jmeter+Ant 环境下 HTML Report 404,Performance Trend 报告空白,求解

faith · 2016年07月20日 · 最后由 faith 回复于 2019年10月31日 · 2118 次阅读

1、最近在摸索 Jenkins+Jmeter+Ant 接口持续集成平台,目前都以跑通,在最后一步生成 html 报告卡主了
自我感觉是由于配置出现错误,一直没找到解决方案,不得已向坛友求教解决方案,不胜感激。主要是以下 2 问题:
1、点击 jenkins 中的 HTML Report 报告出现 404
2、点击 Performance Trend 报告,出现空白


配置如下:


欢迎大家拍砖。。。。谢谢。

共收到 36 条回复 时间 点赞

在 jenkins 的 workspace 里(工作目录)上 有这个 html 报告吗

@pacerron workspace 里面 没有 html 报告,但是在 C:\Users\Administrator.jenkins\jobs\XX\htmlreports\HTML_Report

你这个 project 的工作目录怎么配置的

faith #11 · 2016年07月20日 Author

case 放置在 e 盘,生成的 html 也是在 E 盘,按照上面的配置之后 ,会把 e 盘 html 文件 拷贝到 C:\Users\Administrator.jenkins\jobs\XX\htmlreports\HTML_Report 目录下,但是点击 HTML Report 却是 404

还没用过 Jenkins2,在 1.6 里,点 HTML directory to archive 右边的问号,提示是

The path to the HTML report directory relative to the workspace.

@sanlengjingvv build.xml 配置:

<!-- jmeter生成jtl格式的结果报告的路径 -->
<property name="jmeter.result.jtl.dir" value="C:\Users\Administrator\.jenkins\workspace\xxx\report\jtl" />
<!-- jmeter生成html格式的结果报告的路径 -->
<property name="jmeter.result.html.dir" value="C:\Users\Administrator\.jenkins\workspace\xxx\report\html" />

HTML directory to archive 设置成:report/html/
问题还是存在。

你 4 楼说拷贝到\htmlreports\HTML_Report,为什么 7 楼用却report/html/

faith #15 · 2016年07月20日 Author

@sanlengjingvv 一直搞不定 修改了 build 文件,修改之后还是一样问题存在,哎,求解。看 build 文件,HTML directory to archive 改如何设置?

照着做一遍看看

  • 新建一个自由风格的 job
  • 构建-Execute Windows batch command ``` echo %cd% echo %WORKSPACE% mkdir report\html

echo >> report\html\example.html
echo >> report\html\example.html
echo hello jenkins >> report\html\example.html
echo >> report\html\example.html
echo >> report\html\example.html

dir report\html

- 构建后操作-添加 Publish HTML reports
![](/photo/2016/a07d23429e5b94b057795e1bfd35e99b.png)

楼主输出的测试报告的文件名是什么,试试把 index.html 换成测试报告名称,再不行再看看,Trend 那个不行的话你在 build 的时候把 jtl 也 copy 一份去 job 的 workspace

—— 来自 TesterHome 官方 安卓客户端

faith #17 · 2016年07月21日 Author

@terrychow @sanlengjingvv @pacerron ,谢谢各位的热心解答,问题解决了,是 html 文件名的关系,不过 html 报告偶尔会出现排版混乱的情况,不知道怎么回事,
另外:Performance Trend 报告出现下面的情况
但是从构建历史中去查看又正常,不知道怎么回事。

#12 楼 @faith 排版混乱是指 css 样式没显示?

faith #14 · 2016年07月22日 Author

@terrychow !
如图,

faith #15 · 2016年07月22日 Author

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "") 执行之后 时不时又出现上面的情况。

每次生成的 jtl 文件必须要相同的文件名,才能出来 performance chart 吧?

#15 楼 @faith 再 build 一次应该就好了

faith #23 · 2016年07月22日 Author

@terrychow 重新构建 OK 了。邮件发送不成功,测试邮件可以正常发送,安装的是 ext 邮件插件,
在 job 中使用邮件插件,邮件不发送。下面是 console 中的日志信息。

Email was triggered for: Success
Sending email for trigger: Success
Sending email to: xxxxxx@xxxx.com 
Connection error sending email, retrying once more in 10 seconds...
Connection error sending email, retrying once more in 10 seconds...
Failed after second try sending email
Finished: SUCCESS

#18 楼 @faith 用一个可以用的测试邮箱试试吧

#15 楼 @faith System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "") 在哪里执行可以解决 report 的排版问题吗

faith #26 · 2016年07月23日 Author

@jennyli90 在 jenkins 脚本命令行执行,系统管理 -- 脚本命令行,但是重启 jenkins 还是会出现,每次都需要执行一次,不清楚为啥。

#5 楼 @faith 请问你那个 404 解决 是因为名称问题 是怎么解决的

#11 楼 @terrychow 你好 我的 jenkins 中的 Trend 一直为空 提示

[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at PROJECT level D:\apache-jmeter-3.0\apache-jmeter-3.0\demo\report\html to C:\Users\yangwl\.jenkins\jobs\JMeterTest\htmlreports\JMeter报告
Performance: Percentage of errors greater or equal than 0% sets the build as unstable
Performance: Percentage of errors greater or equal than 0% sets the build as failure



Performance: Recording JMeter reports 'D:\apache-jmeter-3.0\apache-jmeter-3.0\demo\report\jtl\*.jtl'
Performance: no JMeter files matching 'D:\apache-jmeter-3.0\apache-jmeter-3.0\demo\report\jtl\*.jtl' have been found. Has the report generated?. Setting Build to SUCCESS

HTML 报告可以生成 但是 Trend 图表 一直什么都没有 jtl 路径肯定是对的

尝试用构建构建-Execute Windows batch command 用 xcopy 把文件拷贝到 workspace 中去 但是问题仍然存在

faith #24 · 2016年08月21日 Author

@y693055797 修改 bulid 文件中的 html 名称,保持与 job 中设置一致

Failed after second try sending email 您好,这个问题怎么解决的?感谢

faith #26 · 2016年09月22日 Author

@qingran2015 邮件发送失败吗?确认下是否是邮件模板设置错误,建议贴上配置信息

@faith,问下 performance chart 为空具体怎么解决的,你说的 修改 bulid 文件中的 html 名称,保持与 job 中设置一致,指与 job 中的那个名字一致,我现在就卡在这里,麻烦看下

faith #33 · 2016年12月26日 Author

@hexueqin 不好意思,最近比较忙没上论坛,问题解决了吗
构建后操作中 Index page[s] 名称与 build 文件中
html 的文件名一致。

#28 楼 @faith 已经解决了,谢谢

@hexueqin 不客气 没帮上忙。

@faith 可以出来图形了,但是出来的总是上一次构建的结果,有遇到这个情况吗?

faith #34 · 2018年03月14日 Author

@Catapp build.xml 文件没配置好吧。

@Catapp 我现在也是只加载上一次构建的图形,你解决这个问题了吗

你好 请问我报告打开空白的是什么原因呀? 开始是报 404 照你的方法改了后 现在是空白的了

@ 何尔萌 检查一下 html 文件名称

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册