標簽(空格分隔): Jmeter
監聽器用來監聽Jmeter取樣器的測試結果,能夠以樹、表及圖形的形式來顯示測試結果。除了監聽
測試結果之外,大部分監聽器還提供查看,保存和讀取已保存測試結果的方法。
監聽器默認配置
初始化配置文件設置 jmeter初始化文件配置位置/jmeter/bin/jmeter.properties,打開文件搜索Result,可以看到如下內容,這些都是結果記錄相關的配置,#
標注的配置被忽略。在此設置的選項會在GUI模式下起作用,(Summary Report)中已經勾選的選項。
#--------------------------------------------------------------------------- # Results file configuration #--------------------------------------------------------------------------- # This section helps determine how result data will be saved. # The commented out values are the defaults. # legitimate values: xml, csv, db. Only xml and csv are currently supported. #jmeter.save.saveservice.output_format=csv # The below properties are true when field should be saved; false otherwise # # assertion_results_failure_message only affects CSV output #jmeter.save.saveservice.assertion_results_failure_message=true # # legitimate values: none, first, all #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=false # Save ResponseData for failed samples #jmeter.save.saveservice.response_data.on_error=false #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=true #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=true # Timestamp format - this only affects CSV output files # legitimate values: none, ms, or a format suitable for SimpleDateFormat #jmeter.save.saveservice.timestamp_format=ms #jmeter.save.saveservice.timestamp_format=yyyy/MM/dd HH:mm:ss.SSS # For use with Comma-separated value (CSV) files or other formats # where the fields' values are separated by specified delimiters. # Default: #jmeter.save.saveservice.default_delimiter=, # For TAB, one can use: #jmeter.save.saveservice.default_delimiter=\t # Only applies to CSV format files: # Print field names as first line in CSV #jmeter.save.saveservice.print_field_names=true # Optional list of JMeter variable names whose values are to be saved in the result data files. # Use commas to separate the names. For example: #sample_variables=SESSION_ID,REFERENCE # N.B. The current implementation saves the values in XML as attributes, # so the names must be valid XML names. # By default JMeter sends the variable to all servers # to ensure that the correct data is available at the client. # Optional xml processing instruction for line 2 of the file: # Example: #jmeter.save.saveservice.xml_pi=<?xml-stylesheet type="text/xsl" href="../extras/jmeter-results-detail-report.xsl"?> # Default value: #jmeter.save.saveservice.xml_pi= # Prefix used to identify filenames that are relative to the current base #jmeter.save.saveservice.base_prefix=~/ # AutoFlush on each line written in XML or CSV output # Setting this to true will result in less test results data loss in case of Crash # but with impact on performances, particularly for intensive tests (low or no pauses) # Since JMeter 2.10, this is false by default #jmeter.save.saveservice.autoflush=false
GUI模式設置
##后端監聽器
后端偵聽器是一個異步偵聽器,可以將數據推入都數據庫中,提供了InfluxDB,graphite選項
-
界面介紹
-
Backend Listener implementation:
BackendListenerClient
類的實現,Jmeter默認提供如下兩種實現,因為我們使用的influxdb作為持久存儲- org.apache.jmeter.visualizers.backend.graphite.GraphiteBackendListenerClient
- org.apache.jmeter.visualizers.backend.graphite.InfluxdbBackendListenerClient 因為我們使用的influxdb作為持久存儲,所以后續只介紹InfluxdbBackendListenerClient
-
Async Queue size:異步隊列大小 隊列值包含異步處理時的度量標准。除非有一些特定的性能問題,否則最好不要從默認的5000。
我們使用InfluxdbBackendListenerClient
- influxdbMetricsSender:org.apache.jmeter.visualizers.backend.influxdb.HttpMetricsSender
- influxdbUrl:influx數據庫的url。example : http://influxHost:8086/write?db=jmeter
- application:被測試的應用名稱。此值也作為名為“application”的標記存儲在“events”中
- measurement:使用默認的”jmeter“就行
- summaryOnly:為true的情況下,只輸出所有請求的集合數據報告,為flase的情況下,輸出每條數據的詳情報告、
- samplersRegex:正則表達式將與樣本名稱匹配並發送到后端。默認匹配所有
- testTitle:測試名稱。默認的設置為 Test name。該值作為名為“text”的字段存儲在“事件”度量中。 JMeter在測試的開始和結束時自動生成一個注釋,其值以'started'和'ended'結尾
- percentiles:要發送到后端的百分位數,多個值已
;
分割 - TAG_WhatEverYouWant:自定義標簽。您可以根據需要添加任意數量的自定義標簽。對於它們中的每一個,只需創建一個新行並在其名稱前加“TAG_”
實例1 發送數據給influxdb 測試用influxdb在本地,所以地址為0.0.0.0:8086
,application為test_1
,testTitle為baidu and 163
執行結果
實例2 顯示每條請求 測試計划中內有兩個http請求元件,分別請求 百度,163
-
summaryOnly為ture的情況下,只推送一個集合結果
-
summaryOnly為flase的情況下,推送每個請求元件的結果,以及集合結果
grafana界面內transaction 顯示具體的請求
報表內顯示具體請求信息