jmeter测试报告图表导出

1.首先确保X:\apache-jmeter-5.1.1\bin中的jmeter.properties文件中的配置和下面的相同

	jmeter.save.saveservice.bytes = true
    # Only available with HttpClient4
    #jmeter.save.saveservice.sent_bytes=true
    jmeter.save.saveservice.label = true
    jmeter.save.saveservice.latency = true
    jmeter.save.saveservice.response_code = true
    jmeter.save.saveservice.response_message = true
    jmeter.save.saveservice.successful = true
    jmeter.save.saveservice.thread_counts = true
    jmeter.save.saveservice.thread_name = true
    jmeter.save.saveservice.time = true
    jmeter.save.saveservice.connect_time = true
    jmeter.save.saveservice.assertion_results_failure_message = true
    # the timestamp format must include the time and should include the date.
    # For example the default, which is milliseconds since the epoch: 
    jmeter.save.saveservice.timestamp_format = ms
    # Or the following would also be suitable
    # jmeter.save.saveservice.timestamp_format = yyyy/MM/dd HH:mm:ss

•如果希望在Errors报告中展示更详细数据,需要确保如下配置

jmeter.save.saveservice.assertion_results_failure_message = true

如果使用了事务控制器(Transaction Controller),确认Generate parent sample为未勾选状态

•过滤设置

jmeter.reportgenerator.exporter.html.series_filter=(^Login)(-success|-failure)?

报告只展示名为Login这个取样器的数据。该配置包含两部分,(-success|-failure)?是Transactions per second图表所依赖的配置。前面部分接受一个正则表达式用来过滤。

2.导出报表的配置文件是X:\apache-jmeter-5.1.1\bin中的user.properties

可以使用示例配置生成测试报告

# Configure this property to change the report title
#jmeter.reportgenerator.report_title=Apache JMeter Dashboard

# Change this parameter if you want to change the granularity of over time graphs.
# Granularity must be higher than 1000 (1second) otherwise Throughput graphs will be incorrect
# see Bug 60149
#jmeter.reportgenerator.overall_granularity=60000

 Change this parameter if you want to change the granularity of Response time distribution
# Set to 100 ms by default
#jmeter.reportgenerator.graph.responseTimeDistribution.property.set_granularity=100

# Change this parameter if you want to override the APDEX satisfaction threshold.
jmeter.reportgenerator.apdex_satisfied_threshold=1500

# Change this parameter if you want to override the APDEX tolerance threshold.
jmeter.reportgenerator.apdex_tolerated_threshold=3000

# Sets the destination directory for generated html pages, it is better to change it for every generation
# This will override the value set through -o command line option
# jmeter.reportgenerator.exporter.html.property.output_dir=/tmp/test-report

# Indicates which graph series are filtered (regular expression)
# In the below example we filter on Search and Order samples
# Note that the end of the pattern should always include (-success|-failure)?$
# Transactions per second suffixes Transactions with "-success" or "-failure" depending 
# on the result
#jmeter.reportgenerator.exporter.html.series_filter=^(Search|Order)(-success|-failure)?$

# Indicates whether series filter apply only on sample series
jmeter.reportgenerator.exporter.html.filters_only_sample_series=tru

3.生成报告
有两种方式可以进行报告的生成:
①运行测试后进行生成,注意的是在运行的时候需要保存日志文件
jmeter测试报告图表导出_第1张图片
然后点击Tools → Generate HTML report
jmeter测试报告图表导出_第2张图片
Results file (csv or jtl):实用上面的日志文件
user.properties file:使用的user.properties(X:\apache-jmeter-5.1.1\bin中的user.properties)
Output directory:报告文件的保存位置
保存位置可以为空,默认使用$ {JMETER_HOME} / bin / report-output文件夹
填写完成后点击Generate report按钮进行生成

②使用命令行运行
使用日志文件进行生成

  jmeter -g  -o   
  #log file  表示日志文件
  #Path to output folder   表示输出的文件夹
  
  #例如 jmeter -g G:\1.jtl -o G:\1   注意未配置环境变量应先进入对应的位置 
  #日志文件需要提前运行测试生成

使用命令行运行jmter文件后进行生成

  jmeter -n -t  -l  -e -o 
  #test JMX file    测试的jmeter文件
  #test log file      测试的log文件
  #Path to output folder     输出的文件夹
  
  #例如jmeter -n -t C:\Users\一纸荒年\Desktop\so_search.jmx -l G:\1.jtl -e -o G:\1
  #不需要提前运行测试生成日志文件

其他详细的配置信息可以参考http://jmeter.apache.org/usermanual/generating-dashboard.html

你可能感兴趣的:(jmeter测试报告图表导出)