JMeter JTL Files
When capturing Apache JMeter test results, typically the data is written to a log file (JTL file).
JTL file structure
The header line of the JTL file contains column names. The remainder of the file reports the test points, each on a single line.
The timeStamp captured, is a Epoch timestamp which is the time since 1st Jan 1970. Typically, this value is 10 digit long but Apache JMeter adds 3 more characters of precision. In this example 1541088455861 equates to 11/01/2018 @ 1607 (UTC).
There are also measures of threads, time, response, failures and bytes.
timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,Latency,IdleTime,Connect 1541088455861,603,0.0_Home Page,200,OK,Advertise Job 1-1,text,true,,2674,301,10,30,515,0,130
Editing JTL files
Generating HTML test reports from a JTL file will include data from every line within the file.
There may be occasions where sections of the data need to be removed, such as a ramp-up or ramp-down. If you know the time of these data points, you can simply get the epoch timestamp for the times and search for them within the file.
For example we can simply remove the top 5 lines and the bottom 5 lines within this JTL file. Then either overwrite the file or save it as a new file to preserve the original file. The HTML Report would then target just the data that we wished to report on.
timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,Latency,IdleTime,Connect 1541088455861,603,0.0_Home Page,200,OK,Job Round 1-1,text,true,,2674,301,10,30,515,0,130 1541088456101,369,0.0_Home Page,200,OK,Job Offer 2-9,text,true,,2674,301,10,30,284,0,41 1541088456194,368,0.0_Home Page,200,OK,Manage Job Adverts 3-10,text,true,,2674,301,10,30,327,0,190 1541088455881,588,0.0_Home Page,200,OK,Advertise Job 1-7,text,true,,2674,301,10,30,501,0,115 1541088455861,602,0.0_Home Page,200,OK,Job Offer 2-5,text,true,,2674,301,10,30,515,0,134 1541088456101,369,0.0_Home Page,200,OK,Manage Job Adverts 3-9,text,true,,2674,301,10,30,285,0,41 1541088455992,434,0.0_Home Page,200,OK,Job Offer 2-8,text,true,,2674,301,10,30,434,0,86 1541088456069,401,0.0_Home Page,200,OK,Advertise Job 1-9,text,true,,2674,301,10,30,314,0,42 1541088456194,361,0.0_Home Page,200,OK,Job Offer 2-10,text,true,,2674,301,10,30,317,0,190 1541088456163,410,0.0_Home Page,200,OK,Advertise Job 1-10,text,true,,2674,301,10,30,367,0,220 1541088455858,604,0.0_Home Page,200,OK,Job Offer 2-2,text,true,,2674,301,10,30,477,0,135 1541088455861,558,0.0_Home Page,200,OK,Manage Job Adverts 3-2,text,true,,2674,301,10,30,439,0,130 1541088455976,493,0.0_Home Page,200,OK,Advertise Job 1-8,text,true,,2674,301,10,30,405,0,99 1541088455859,604,0.0_Home Page,200,OK,Manage Job Adverts 3-3,text,true,,2674,301,10,30,476,0,132 1541088455857,606,0.0_Home Page,200,OK,Manage Job Adverts 3-1,text,true,,2674,301,10,30,606,0,134 1541088455859,559,0.0_Home Page,200,OK,Job Offer 2-4,text,true,,2674,301,10,30,441,0,131 1541088455861,559,0.0_Home Page,200,OK,Advertise Job 1-4,text,true,,2674,301,10,30,474,0,130 1541088455860,772,0.0_Home Page,200,OK,Manage Job Adverts 3-4,text,true,,2674,301,10,30,772,0,129 1541088455861,558,0.0_Home Page,200,OK,Advertise Job 1-3,text,true,,2674,301,10,30,439,0,131 1541088455858,561,0.0_Home Page,200,OK,Job Offer 2-6,text,true,,2674,301,10,30,442,0,133 1541088455861,559,0.0_Home Page,200,OK,Manage Job Adverts 3-5,text,true,,2674,301,10,30,559,0,125 1541088455860,559,0.0_Home Page,200,OK,Advertise Job 1-2,text,true,,2674,301,10,30,440,0,131 1541088455859,559,0.0_Home Page,200,OK,Advertise Job 1-6,text,true,,2674,301,10,30,441,0,132 1541088455896,572,0.0_Home Page,200,OK,Manage Job Adverts 3-7,text,true,,2674,301,10,30,445,0,100 1541088455898,740,0.0_Home Page,200,OK,Job Offer 2-7,text,true,,2674,301,10,30,687,0,99 1541088455859,560,0.0_Home Page,200,OK,Advertise Job 1-5,text,true,,2674,301,10,30,441,0,132 1541088455862,559,0.0_Home Page,200,OK,Job Offer 2-1,text,true,,2674,301,10,30,473,0,129 1541088455997,430,0.0_Home Page,200,OK,Manage Job Adverts 3-8,text,true,,2674,301,10,30,344,0,81 1541088455861,1196,0.0_Home Page,200,OK,Manage Job Adverts 3-6,text,true,,2674,301,10,30,1136,0,128 1541088455860,1197,0.0_Home Page,200,OK,Job Offer 2-3,text,true,,2674,301,10,30,1136,0,130
Fixing damaged files
If a test was to fail or the java process terminated ,the JTL file may become damaged. Since it is a plain text file it is relatively easy to repair.
Typically, what happens is the end line in the file, will not be fully written. If this happens when you try to generate a HTML report it will fail stating that the number of columns is incorrect.
To fix this simply remove the line and save the file.
1541088455997,430,0.0_Home Page,200,OK,Manage Job Adverts 3-8,text,true,,2674,301,10,30,344,0,81 1541088455861,1196,0.0_Home Page,200,OK,Manage Job Adverts 3-6,text,true,,2674,301,10,30,1136,0,128 1541088455860,1197,
Unexpected Strings
There are occasions where failure messages may introduce problematic data into the JTL file. Since the file is typically comma separated, if a comma is returned and written to the file it will cause the column number to mismatch and therefore cause the HTML report generation to fail.
To fix this you can search through the file to identify the failure message and simply remove the extra comma. Then re-save the file and generate the HTML report.