Jmeterreport优化
作者:手机用户2502903761 | 来源:互联网 | 2022-12-27 11:16
优化大致过程
生成并的报告模板:
public="-//W3C//DTD HTML 4.01 Transitional//EN" doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
for-each select="*">
if test="position() = 1 or @tn != preceding-sibling::*[1]/@tn">
- class="navigation">Thread:
if>
-
success
failure
class="detail">
class="group">Sampler
class="zebra">
class="data key">Thread Name | class="data delimiter">: | class="data"> |
class="data key">Timestamp | class="data delimiter">: | class="data">class="patch_timestamp"> |
class="data key">Time | class="data delimiter">: | class="data"> ms |
class="data key">Latency | class="data delimiter">: | class="data"> ms |
class="data key">Bytes | class="data delimiter">: | class="data"> |
class="data key">Sample Count | class="data delimiter">: | class="data"> |
class="data key">Error Count | class="data delimiter">: | class="data"> |
class="data key">Response Code | class="data delimiter">: | class="data"> |
class="data key">Response Message | class="data delimiter">: | class="data"> |
class="trail">
if test="count(assertionResult) > 0">
class="group">Assertion
class="zebra">
for-each select="assertionResult">
failure
failure
class="data assertion" colspan="3"> |
class="data key">Failure | class="data delimiter">: | class="data"> |
class="data key">Error | class="data delimiter">: | class="data"> |
class="data key">Failure Message | class="data delimiter">: | class="data"> |
for-each>
class="trail">
if>
class="group">Request
class="zebra">
class="data key">Method/Url | class="data delimiter">: | class="data">class="data"> |
class="data key">Query String | class="data delimiter">: | class="data">class="data"> |
class="data key">COOKIEs | class="data delimiter">: | class="data">class="data"> |
class="data key">Request Headers | class="data delimiter">: | class="data">class="data"> |
class="trail">
class="group">Response
class="zebra">
class="data key">Response Headers | class="data delimiter">: | class="data">class="data"> |
class="data key">Response Data | class="data delimiter">: | class="data">class="data"> |
class="data key">Response File | class="data delimiter">: | class="data">class="data"> |
class="trail">
for-each>
View Code
报模拟放到jmeter_home/extras
1、修改jmeter.properties文件,打开一些输出内容开关(下图根据需要选择相关项,具体就不用多说了吧)
jmeter.save.saveservice.assertion_results=none
#
jmeter.save.saveservice.data_type=true
jmeter.save.saveservice.label=true
jmeter.save.saveservice.response_code=true
# response_data is not currently supported for CSV output
jmeter.save.saveservice.response_data=true
# Save ResponseData for failed samples
jmeter.save.saveservice.response_data.on_error=true
jmeter.save.saveservice.response_message=true
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.thread_name=true
jmeter.save.saveservice.time=true
jmeter.save.saveservice.subresults=true
jmeter.save.saveservice.assertions=true
jmeter.save.saveservice.latency=true
# Only available with HttpClient4
jmeter.save.saveservice.connect_time=false
jmeter.save.saveservice.samplerData=false
jmeter.save.saveservice.responseHeaders=false
jmeter.save.saveservice.requestHeaders=false
jmeter.save.saveservice.encoding=false
jmeter.save.saveservice.bytes=true
# Only available with HttpClient4
jmeter.save.saveservice.sent_bytes=true
jmeter.save.saveservice.url=true
jmeter.save.saveservice.filename=false
jmeter.save.saveservice.hostname=false
jmeter.save.saveservice.thread_counts=true
jmeter.save.saveservice.sample_count=false
jmeter.save.saveservice.idle_time=false
View Code
2、制定一份自己的输出模板。(不用默认的jmeter_home/extras/jmeter-results-detail-report.xsl模板,也可以网上自己找份。)
3、最后执行,生成对应的HTML报告(一般我们都在linux环境 下运行,语句大致如下,其中my_project_template.xsl就上第2步说的定制模板,这个是网上找的一份。)
xsltproc $jmeter_home/extras/my_project_template.xsl $my_project_workspace/result/jtl/$test_name/${test_name}.jtl > $my_project_workspace/result/html/$test_name/${test_name}.html
最后报告如下:
优化后的HTML报告,多了接口地址、接口参数、Headers信息(包括COOKIE、session),而且有返回结果。失败原因一目了然