Jmeter默认的报告展示的信息比较少,如果出错了,不是很方便定位问题。由Jmeter默认报告优化这篇文章可知,其实由.jtl格式转换为.html格式的报告过程中,style文件起了很关键的作用。下面介绍另一种style文件的使用方法:
1、下载style文件:jmeter.results.shanhe.me.xsl 见附件
2、把下载的文件放到jmeter的extras目录下。
3、修改jmeter.properties文件如下部分,我这里都修改成true,这样执行完脚本后就会保存这些结果到.jtl文件里面:
jmeter.save.saveservice.data_type=truejmeter.save.saveservice.label=truejmeter.save.saveservice.response_code=true# response_data is not currently supported for CSV outputjmeter.save.saveservice.response_data=true# Save ResponseData for failed samplesjmeter.save.saveservice.response_data.on_error=falsejmeter.save.saveservice.response_message=truejmeter.save.saveservice.successful=truejmeter.save.saveservice.thread_name=truejmeter.save.saveservice.time=truejmeter.save.saveservice.subresults=truejmeter.save.saveservice.assertions=truejmeter.save.saveservice.latency=truejmeter.save.saveservice.connect_time=truejmeter.save.saveservice.samplerData=truejmeter.save.saveservice.responseHeaders=truejmeter.save.saveservice.requestHeaders=truejmeter.save.saveservice.encoding=falsejmeter.save.saveservice.bytes=truejmeter.save.saveservice.url=truejmeter.save.saveservice.filename=truejmeter.save.saveservice.hostname=truejmeter.save.saveservice.thread_counts=truejmeter.save.saveservice.sample_count=truejmeter.save.saveservice.idle_time=true
4、修改build.xml文件,如下第7行style的值修改为新下载的xsl文件名:
<target name="report" depends="_message_xalan"><xsltclasspathref="xslt.classpath"force="true"in="${testpath}/${test}.jtl"out="${testpath}/${test}.html"style="${basedir}/jmeter-results-shanhe-me.xsl"><param name="showData" expression="${show-data}"/></xslt></target>
5、执行脚本,生成报告如下,明显感觉展示的内容比之前的报告多很多,定位问题也比较方便直观: