Listeners are the elements that provide the user access to the test case data that JMeter gathers during the execution. This data obtained by the listener will be in the form of a table or graph or tree or log files. These raw data will be written to an output file specified in the JMeter by all listeners.
Default configuration can be defined in two ways which are
- In the user.properties or properties file in the /bin folder. Default format can be changed by adding jmeter.save.saveservice.output_format=
- Another way is by using Config popup which is shown below
After the test run, the results of the test will be available in JTL files or JMeter Text Logs (JTL) files which are the default. If same name is used for output files in multiple tests, JMeter keeps adding the newly created data at the end of the file.
The JMeter listener provides an efficient way to record the data by recording the results in a file instead of a User Interface. This way the overhead of running a GUI is also avoided. Listener can be run in ways, GUI mode and non-GUI mode. Simple Data Writer is used in GUI mode while data file is created using the I-flag in non-GUI mode. Using simple Data Write with CSV format also helps save in the amount of memory used.
CSV Log format
CSV Log format varies depending on the selected data items in the configuration and the file records only those specified data items which has fixed order of how the columns appears which is as follows −
|Field||Description||Example of the value|
|Label||Sampler label||HTTP Request|
|Timestamp||In Milliseconds since 1/1/1970||1234113991011|
|datatype||For example: Text||Text|
|responseCode||For example 302, 401||302|
|responseMessage||For example: OK||OK|
|threadName||Thread Group 1-1|
|Bytes||No. of bytes in the sample||35040|
|Success||True or False||False|
|Latency||Time to first response||128|
|allThreads||Total no. of active threads in all groups||1|
|grpThreads||No. of active threads in this thread group||1|
|Filename||if ‘Save Response to File’ was used|
|SampleCount||No. of samples (1, unless multiple samples are accumulated)||1|
|IdleTime||Idle time in milliseconds (normally 0)|
|ErrorCount||Gives a count of errors ( It is 0 or 1, unless multiple samples are accumulated)||1|
|Hostname||Where the sample is generated||LaptopManas|
To Save Response Data
Even though, the response data can be saved in the XML log file, you cannot save large files and images. In such cases, the Post-Processor Save_Responses_to_a_file can be used where for each sample, a new file is generated. The file name is saved with the sample which can then be included in the sample log output. The data can be accessed from the file if required as and when the log file gets reloaded.
To Load (read) response data
Use ‘Browse’ button to select and view the results file. You can also create a dummy testplan with the appropriate Listener if needed.
To Save the GUI Data of the Listener
In JMeter, any listener can be saved as a .PNG file by doing the following action.
Select Edit then Select Save As Image which is to be done in the left panel and then enter the file name of your choice.