Search code examples
jmeterjmeter-5.0

JMeter No-Gui CSV Report adding additional column for some entries


I have written a script that runs my JMeter script with an additional property file.

I have noticed depending on where I run the script from, the CSV output will sometimes have an additional column, meaning I can't generate the HTML report.

I was wondering if this has been seen before, or if it is a bug.

The script ends up running the following command - The idea being once the script has finished it auto generated the report.

C:\apache-jmeter-5.6.2\bin\jmeter -n -t "C:\perfTesting\MicroApps\ViewBooking\ViewBooking_v1-0.jmx" -q "C:\perfTesting\MicroApps\ViewBooking\ViewBooking.properties" -l "C:\perfTesting\MicroApps\ViewBooking\Results\<dateOfWhenRan>\Summary_Report.csv" -e -o "C:\perfTesting\MicroApps\ViewBooking\Results\<dateOfWhenRan>\Output\"

The script sits at C:\perfTesting

When I run it from here, my CSV produces the following output (Snippit)

Look at lines 5 and 9 - For where the website url gets added

Look at lines 4 and 8 - For where Latency is null (but the entry is still 17 cols instead of 16)

timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,Latency,IdleTime,Connect
1708972397808,406,0.0 - Login,200,"Number of samples in transaction : 1, number of failing samples : 0",View Booking-ThreadStarter 2-1,,true,,1342,798,1,2,0,167,310
1708972397967,406,001 - login,200,OK,View Booking-ThreadStarter 2-1,text,true,,1342,798,1,2,403,0,310
1708972397808,406,0.0 - Login,200,"Number of samples in transaction : 1, number of failing samples : 0",View Booking-ThreadStarter 2-1,,true,,1342,798,1,2,null,0,167,310
1708972397967,406,001 - login,200,OK,View Booking-ThreadStarter 2-1,text,true,,1342,798,1,2,<Website Url it is hitting>,403,0,310
1708972397801,442,0.0 - Login,200,"Number of samples in transaction : 1, number of failing samples : 0",My Bookings-ThreadStarter 1-1,,true,,1341,798,1,2,0,167,310
1708972397967,442,001 - login,200,OK,My Bookings-ThreadStarter 1-1,text,true,,1341,798,1,2,442,0,310
1708972397801,442,0.0 - Login,200,"Number of samples in transaction : 1, number of failing samples : 0",My Bookings-ThreadStarter 1-1,,true,,1341,798,1,2,null,0,167,310
1708972397967,442,001 - login,200,OK,My Bookings-ThreadStarter 1-1,text,true,,1341,798,1,2,<Website Url it is hitting>,442,0,310
1708972398815,77,0.0 - Login,200,"Number of samples in transaction : 1, number of failing samples : 0",View Booking-ThreadStarter 2-2,,true,,1340,798,2,3,0,3,13
1708972398816,77,001 - login,200,OK,View Booking-ThreadStarter 2-2,text,true,,1340,798,2,3,77,0,13

Image of the same code but coloured so can easily spot the issues

This means when the report tries to generate I get the classic Mismatch between expected number of columns:16 and columns in CSV file:17, check your jmeter.save.saveservice.* configuration or check if line 11 in 'C:\PerfTesting\MicroApps\ViewBooking\Results\2024-02-26-19-02\Summary_Report.csv' is complete which is down to some of the entries having the <Website Url it is hitting>

Now if I run the following command jmeter -n -t "C:\perfTesting\MicroApps\ViewBooking\ViewBooking_v1-0.jmx" -q "C:\perfTesting\MicroApps\ViewBooking\ViewBooking.properties" in the C:\apache-jmeter-5.6.2\bin\ directory, it produces the CSV perfectly, and I can then generate the report separately.

I'm currently testing what happens if I run the the test and try to generator the report from the C:\apache-jmeter-5.6.2\bin\ directory.

But I was wondering if anyone might know why the location of running the script would make the CSV produce different entries.


Solution

  • In classic developer fashion, I spent hours looking for an answer, eventually giving up and asking for help, to go then and solve the problem.

    The Cause

    In Jmeter V5.6.2 the jmeter.save.saveservice.url property in the apache-jmeter-5.6.2\bin\jmeter.properties file is set to true, and when using the -l flag in non-gui mode, JMeter will create a global listener using these properties

    In my JMX file I had a listener that was enabled and outputting the report to the exact same location - however, this listener had Save Url set to false.

    It turns out the global listener and the one I had enabled in Jmeter were clashing and combining the results, resulting in an invalid CSV which had entries of both 16 and 17 columns.

    Fix

    Disable the Listener In the JMX file