Flexible File Writer

Download

JMeter has very simpe test results writing capabilities with Simple Data Writer plugin. File formats restricted to XML and CSV, fields order predefined. So you may find Simple Data Writer not enough for your task.

Flexible File Writer plugin allows writing test results in flexible format, specified via GUI.

Make note that JMeter variables/functions in filename field processed only once when test starts and file opened for writing.

If your format requires some header and/or footer, you may specify it in corresponding fields. FFW will write header once it opened file and footer right before closing it.

Record Specification

Record specification may consist of fields specification and string constants. Fields are separated from constants with '|' symbols. Plugin will not add any extra bytes to file, so you must specify newline characters manually (\r, \n, \t works for newlines and tabs).

For example, simple tab separated file specified as:

    startTime|\t|responseTime|\t|responseCode|\t|isSuccsessful|\r\n

If you want to have '|' symbol itself to be written to file, use '||' in record specification.

There is special property named kg.apc.jmeter.reporters.FFWBufferSize with default of 10KB. This property controls the size for the buffer used to compose record to write to file. See https://groups.google.com/forum/#!topic/jmeter-plugins/Mldv8vs2L3g for some more details.

Available Fields

startTime epoch time when request was started
endTime epoch time when reading response ended
responseTime response time, time to full response loaded
latency latency, time to first response byte received (if available)
connectTime time to establish connection (if available)
responseCode response code (200, 404 etc.)
responseMessage response message (OK, Not Found etc.)
responseHeaders response headers (if present in sample)
responseData response data
requestData request data from sample
sentBytes number of request bytes sent, if available
receivedBytes number of request bytes sent (if available)
threadName name of thread in Thread Group that processed request
threadsCount overall active threads count (since version 1.1.0)
sampleLabel name of the sampler that made request
isSuccsessful is response was marked as successful
isFailed is response was marked as failed (surrogate field)
startTimeMillis same as startTime, but divided by 1000 (surrogate field, example: 1311121131.362)
endTimeMillis same as endTime, but divided by 1000 (surrogate field)
responseTimeMicros same as responseTime, but multiplied by 1000 (surrogate field)
latencyMicros same as latency, but multiplied by 1000 (surrogate field)
grpThreads number of active threads in this thread group
sampleCount number of samples (1, unless multiple samples are aggregated)
errorCount number of errors (0 or 1, unless multiple samples are aggregated)
URL The sample URL
variable#<N> Sample variable with index N, see below for details

Saving JMeter Variables with Flexible File Writer

Jmeter have feature to specify some variables to be saved in result files. You may find here JMeter doc on setting up saving. Shortly is you have to specify JMeter property sample_variables to save variables by name, for instance, with command line property setting -Jsample_variables=var1,var2, or just in user.properties file. It turns out that JMeter have no API to change sample_variables setting during runtime, so we have to rely on pre-run property setting. Flexible File Writer can then use those variables to save in file, you need to specify field variable#0 in record specification. Variable indexes are zero based, e.g. var1 have index '0', var2 have index '1'.

Example and Tutorials

Download Example Test Plan

Tutorials