English 中文(简体)
jMeter - Listeners
  • 时间:2024-11-05

jMeter - Listeners


Previous Page Next Page  

Listeners provide access to the information JMeter gathers about the test cases while JMeter runs. The results or information gathered by psteners can be shown in the form of −

    tree

    tables

    graphs

    log file

All psteners write the same raw data to the output file when one is specified.

Default Configuration

The default items to be saved can be defined in one of the following two ways −

    In the jmeter.properties (or user.properties) file. This file is present in the /bin folder of JMeter.To change the default format, find the following pne in jmeter.properties −

jmeter.save.saveservice.output_format=

    By using the Config popup as shown in the following screenshot −

JMeter Config PopUp

JMeter creates results of a test run as JMeter Text Logs(JTL). These are normally called JTL files, as that is the default extension − but any extension can be used.

If multiple tests are run using the same output file name, then JMeter automatically appends new data at the end of the file.

The pstener can record results to a file but not to the UI. It is meant to provide an efficient means of recording data by epminating GUI overhead.

When running in −

    GUI mode − use the pstener Simple Data Writer

    non-GUI mode − the -l flag can be used to create a data file.

Listeners can use a lot of memory if there are a lot of samples. To minimize the amount of memory needed, use the Simple Data Write with CSV format.

CSV Log format

The CSV log format depends on which data items are selected in the configuration. Only the specified data items are recorded in the file. The order of appearance of columns is fixed, and is as follows −

Field Description Value Example
timeStamp in milpseconds since 1/1/1970 1354223881017
elapsed in milpseconds 1858
label sampler label HTTP Request
responseCode e.g. 200, 404 200
responseMessage e.g. OK OK
threadName Thread Group 1-1
dataType e.g. text text
success true or false true
failureMessage if any
bytes number of bytes in the sample 34908
grpThreads number of active threads in this thread group 1
allThreads total number of active threads in all groups 1
URL http://tutorialspoint.com
Filename if Save Response to File was used
latency time to first response 132
encoding utf-8
SampleCount number of samples (1, unless multiple samples are aggregated) 1
ErrorCount number of errors (0 or 1, unless multiple samples are aggregated) 0
Hostname where the sample was generated LaptopManisha
IdleTime number of milpseconds of Idle time (normally 0)
Variables if specified

Saving Response Data

The response data can be saved in the XML log file if required. However it does not allow to save large files and images. In such cases, use the Post-Processor Save_Responses_to_a_file. This generates a new file for each sample, and saves the file name with the sample. The file name can then be included in the sample log output. The data will be retrieved from the file if necessary when the sample log file is reloaded.

Loading (reading) response data

To view an existing results file, you can use the file "Browse..." button to select a file. If necessary, just create a dummy testplan with the appropriate Listener in it.

Saving the Listener GUI Data

JMeter is capable of saving any pstener as a PNG file. To do so,

    Select the pstener in the left panel by selecting Edit → Save As Image. A file dialog appears.

    Enter the desired name.

    Save the pstener.

Advertisements