JMeter Report Dashboard

JMeter Report Dashboard pojawił się wraz z wersją 3.0 JMeter’a. W tej chwili mamy wersję 3.1 i 3.2RC. W dzisiejszym wpisie pokażę jak skonfigurowałem i używam tej świetnej funkcjonalności.

Najpierw pokażę kilka podstawowych wykresów jakie można uzyskać. Wachlarz dostępnych w JMeter Report Dashboard wykresów w jest dużo większy. TL;DR

JMeter Report Dashboard
Apache JMeter Dashboard – widok podstawowy

Pokazane poniżej wykresy są pozyskane poprzez eksport widoku do pliku (nie jest to wycinek ekranu, tylko dobrej jakości plik graficzny)

JMeter Report Dashboard
Response Time Distribution
JMeter Report Dashboard
Response Times Over Time

Trochę mało widać. A raczej za dużo. Możemy wybrać interesującą nas metrykę

JMeter Report Dashboard
Response Times Over Time – wybrana metryka

Najeżdżając na kropeczkę możemy odczytać wartość w wybranym punkcie. Jeśli zainteresuje nas tylko wybrany obszar możemy zrobić zoom’a

JMeter Report Dashboard
Response Times Over Time – zoom
JMeter Report Dashboard
Response Times Percentiles

Jak na powyższym widzicie szału z testowanym systemem nie ma.

Do wygenerowania JMeter Report Dashboard potrzebujemy danych. Nie mogą być byle jakie. Muszą być zapisane w pliku CSV i muszą tworzyć określony zestaw.

JMeter Report Dashboard
Moja konfiguracja (Windows). Nazwa pliku zawiera datę i czas startu testu.

Zestaw zbieranych do pliku danych

JMeter Report Dashboard

Jeszcze jedna istotna kwestia

JMeter Report Dashboard

Jeśli mamy zaznaczone ‚Generate parent sample’ nie będziemy mieli kilku wykresów bazujących na poszczególnych żądaniach. Jeśli potrzebujemy innych czasów niż opartych na metrykach dla całego Transaction Controller’a, musimy odznaczyć ‚Generate parent sample’ (w sumie to ustawienie domyślne).

Kolejna ważna rzecz to konfiguracja samego jmeter’a.

Do user.properties musimy wkleić

#---------------------------------------------------------------------------
# Reporting configuration
#---------------------------------------------------------------------------

# Sets the satisfaction threshold for the APDEX calculation (in milliseconds).
#jmeter.reportgenerator.apdex_satisfied_threshold=500

# Sets the tolerance threshold for the APDEX calculation (in milliseconds).
#jmeter.reportgenerator.apdex_tolerated_threshold=1500

# Regular Expression which Indicates which samples to keep for graphs and statistics generation.
# Empty value means no filtering
#jmeter.reportgenerator.sample_filter=

# Sets the temporary directory used by the generation process if it needs file I/O operations.
#jmeter.reportgenerator.temp_dir=temp

# Sets the size of the sliding window used by percentile evaluation.
# Caution : higher value provides a better accuracy but needs more memory.
#jmeter.reportgenerator.statistic_window = 20000

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

# Used to generate a report based on a date range
# Date range start date at format dd/MM/yyyy HH:mm:ss
#jmeter.reportgenerator.start_date=
# Date range end date at format dd/MM/yyyy HH:mm:ss
#jmeter.reportgenerator.end_date=

# Defines the overall granularity for over time graphs
# Granularity must be higher than 1000 (1second) otherwise Throughput graphs will be incorrect
# see Bug 60149
jmeter.reportgenerator.overall_granularity=1000

# Exclude transaction controller from analysis
# true by default
jmeter.reportgenerator.exclude_tc_from_top5_errors_by_sampler=true

# Response Time Percentiles graph definition
jmeter.reportgenerator.graph.responseTimePercentiles.classname=org.apache.jmeter.report.processor.graph.impl.ResponseTimePercentilesGraphConsumer
jmeter.reportgenerator.graph.responseTimePercentiles.title=Response Time Percentiles

# Response Time Distribution graph definition
jmeter.reportgenerator.graph.responseTimeDistribution.classname=org.apache.jmeter.report.processor.graph.impl.ResponseTimeDistributionGraphConsumer
jmeter.reportgenerator.graph.responseTimeDistribution.title=Response Time Distribution
jmeter.reportgenerator.graph.responseTimeDistribution.property.set_granularity=1000

# Active Threads Over Time graph definition
jmeter.reportgenerator.graph.activeThreadsOverTime.classname=org.apache.jmeter.report.processor.graph.impl.ActiveThreadsGraphConsumer
jmeter.reportgenerator.graph.activeThreadsOverTime.title=Active Threads Over Time
jmeter.reportgenerator.graph.activeThreadsOverTime.property.set_granularity=${jmeter.reportgenerator.overall_granularity}

# Time VS Threads graph definition
jmeter.reportgenerator.graph.timeVsThreads.classname=org.apache.jmeter.report.processor.graph.impl.TimeVSThreadGraphConsumer
jmeter.reportgenerator.graph.timeVsThreads.title=Time VS Threads

# Bytes Throughput Over Time graph definition
jmeter.reportgenerator.graph.bytesThroughputOverTime.classname=org.apache.jmeter.report.processor.graph.impl.BytesThroughputGraphConsumer
jmeter.reportgenerator.graph.bytesThroughputOverTime.title=Bytes Throughput Over Time
jmeter.reportgenerator.graph.bytesThroughputOverTime.exclude_controllers=true
jmeter.reportgenerator.graph.bytesThroughputOverTime.property.set_granularity=${jmeter.reportgenerator.overall_granularity}

# Response Time Over Time graph definition
jmeter.reportgenerator.graph.responseTimesOverTime.classname=org.apache.jmeter.report.processor.graph.impl.ResponseTimeOverTimeGraphConsumer
jmeter.reportgenerator.graph.responseTimesOverTime.title=Response Time Over Time
jmeter.reportgenerator.graph.responseTimesOverTime.property.set_granularity=${jmeter.reportgenerator.overall_granularity}

# Percentiles Response Times over time
jmeter.reportgenerator.graph.responseTimePercentilesOverTime.classname=org.apache.jmeter.report.processor.graph.impl.ResponseTimePercentilesOverTimeGraphConsumer
jmeter.reportgenerator.graph.responseTimePercentilesOverTime.title Response Time Percentiles Over Time (successful requests only)
jmeter.reportgenerator.graph.responseTimePercentilesOverTime.property.set_granularity=${jmeter.reportgenerator.overall_granularity}

# Synthetic Response Time Distribution
jmeter.reportgenerator.graph.syntheticResponseTimeDistribution.classname=org.apache.jmeter.report.processor.graph.impl.SyntheticResponseTimeDistributionGraphConsumer
jmeter.reportgenerator.graph.syntheticResponseTimeDistribution.title=Synthetic Response Times Distribution
jmeter.reportgenerator.graph.syntheticResponseTimeDistribution.exclude_controllers=true
jmeter.reportgenerator.graph.syntheticResponseTimeDistribution.property.set_satisfied_threshold=${jmeter.reportgenerator.apdex_satisfied_threshold}
jmeter.reportgenerator.graph.syntheticResponseTimeDistribution.property.set_tolerated_threshold=${jmeter.reportgenerator.apdex_tolerated_threshold}

# Latencies Over Time graph definition
jmeter.reportgenerator.graph.latenciesOverTime.classname=org.apache.jmeter.report.processor.graph.impl.LatencyOverTimeGraphConsumer
jmeter.reportgenerator.graph.latenciesOverTime.title=Latencies Over Time
jmeter.reportgenerator.graph.latenciesOverTime.property.set_granularity=${jmeter.reportgenerator.overall_granularity}

# Connect Time Over Time graph definition
jmeter.reportgenerator.graph.connectTimeOverTime.classname=org.apache.jmeter.report.processor.graph.impl.ConnectTimeOverTimeGraphConsumer
jmeter.reportgenerator.graph.connectTimeOverTime.title=Connect Time Over Time
jmeter.reportgenerator.graph.connectTimeOverTime.property.set_granularity=${jmeter.reportgenerator.overall_granularity}

# Response Time Vs Request graph definition
jmeter.reportgenerator.graph.responseTimeVsRequest.classname=org.apache.jmeter.report.processor.graph.impl.ResponseTimeVSRequestGraphConsumer
jmeter.reportgenerator.graph.responseTimeVsRequest.title=Response Time Vs Request
jmeter.reportgenerator.graph.responseTimeVsRequest.exclude_controllers=true
jmeter.reportgenerator.graph.responseTimeVsRequest.property.set_granularity=${jmeter.reportgenerator.overall_granularity}

# Latencies Vs Request graph definition
jmeter.reportgenerator.graph.latencyVsRequest.classname=org.apache.jmeter.report.processor.graph.impl.LatencyVSRequestGraphConsumer
jmeter.reportgenerator.graph.latencyVsRequest.title=Latencies Vs Request
jmeter.reportgenerator.graph.latencyVsRequest.exclude_controllers=true
jmeter.reportgenerator.graph.latencyVsRequest.property.set_granularity=${jmeter.reportgenerator.overall_granularity}

# Hits Per Second graph definition
jmeter.reportgenerator.graph.hitsPerSecond.classname=org.apache.jmeter.report.processor.graph.impl.HitsPerSecondGraphConsumer
jmeter.reportgenerator.graph.hitsPerSecond.title=Hits Per Second
jmeter.reportgenerator.graph.hitsPerSecond.exclude_controllers=true
jmeter.reportgenerator.graph.hitsPerSecond.property.set_granularity=${jmeter.reportgenerator.overall_granularity}

# Codes Per Second graph definition
jmeter.reportgenerator.graph.codesPerSecond.classname=org.apache.jmeter.report.processor.graph.impl.CodesPerSecondGraphConsumer
jmeter.reportgenerator.graph.codesPerSecond.title=Codes Per Second
jmeter.reportgenerator.graph.codesPerSecond.exclude_controllers=true
jmeter.reportgenerator.graph.codesPerSecond.property.set_granularity=${jmeter.reportgenerator.overall_granularity}

# Transactions Per Second graph definition
jmeter.reportgenerator.graph.transactionsPerSecond.classname=org.apache.jmeter.report.processor.graph.impl.TransactionsPerSecondGraphConsumer
jmeter.reportgenerator.graph.transactionsPerSecond.title=Transactions Per Second
jmeter.reportgenerator.graph.transactionsPerSecond.property.set_granularity=${jmeter.reportgenerator.overall_granularity}

# HTML Export
jmeter.reportgenerator.exporter.html.classname=org.apache.jmeter.report.dashboard.HtmlTemplateExporter

# Sets the source directory of templated files from which the html pages are generated.
#jmeter.reportgenerator.exporter.html.property.template_dir=report-template

# Sets the destination directory for generated html pages.
# This will be overridden by the command line option -o
#jmeter.reportgenerator.exporter.html.property.output_dir=report-output

# Regular Expression which Indicates which graph series are filtered in display
# Empty value means no filtering
#jmeter.reportgenerator.exporter.html.series_filter=

# Indicates whether series filter apply only on sample series or to all series
# setting this to false can lead to empty graphs if series_filter does not
# contain required series
#jmeter.reportgenerator.exporter.html.filters_only_sample_series=true

# Indicates whether only controller samples are displayed on graphs that support it.
#jmeter.reportgenerator.exporter.html.show_controllers_only=false

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.failureMessage = false
jmeter.save.saveservice.assertion_results_failure_message = false
# 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

Mając skonfigurowanego jmeter’a możemy wykonać test i zebrać dane do raportu.

Generowanie raportu

Jeśli uruchamiamy test w trybie non-GUI to możemy zażądać wygenerowania raportu po zakończeniu testu

jmeter -n -t <plik JMX> -l <test log file> -e -o <ścieżka do pustego folderu>

W każdym innym przypadku uruchamiamy generowanie raportu przez

jmeter -g <plik CSV> -o <ścieżka do pustego folderu>

Ja na swoje potrzeby stworzyłem prostego cmd, którego umieściłem w /bin/ jmeter’a i ustawiłem odpowiednio zmienną środowiskową path.
Uruchamiam ‚raport ‚ w folderze z plikiem wynikowym testu i po chwili dostaję raport.

Mój raport.cmd

@echo off
SETLOCAL ENABLEEXTENSIONS
set rap_dir=%date%_%time:~0,2%_%time:~3,2%_%time:~6,2%
mkdir Raport_"%rap_dir%"
IF ERRORLEVEL 0 jmeter -g %1 -o Raport_%rap_dir%

Zachęcam do eksperymentów i stosowania

JMeter Report Dashboard

Dodaj komentarz