Changing delimiter used by jmeter to save results as CSV - jmeter

I have a Jmeter script which will fire some HTTP requests. From the requests i am getting the required values to my output.
In the jmeter.properties file i have mentioned as follow:
# For use with Comma-separated value (CSV) files or other formats
# where the fields' values are separated by specified delimiters
# Default:
#jmeter.save.saveservice.default_delimiter=|
# For TAB, since JMeter 2.3 one can use:
#jmeter.save.save-service.default_delimiter=\t
But it is not reflecting in my output.
How to resolve this issue?

I have the same problem. I've added to the jmeter.properties file the following lines:
jmeter.save.saveservice.output_format=csv
jmeter.save.saveservice.default_delimiter=;
csvread.delimiter=;
Now Simple Data Writer saves results using ; to separate fields' values. But when I save data in the Aggregate Report element (by clicking the 'Save Table Data' button) the values in result aggregate.csv file are separated by ,

If you really did what you are describing in the code excerpt, then you forgot to uncomment fields by removing # before the concerned line.
Furthermore you are making a mistake in the property names, they should be:
jmeter.save.saveservice.default_delimiter=|
jmeter.save.saveservice.default_delimiter=\t
For full reference, see jmeter.properties.
But I am not sure to answer your question , as it is not clear though, can you clarify it.
Regards
Philippe M.

Related

How to define special characters in JMeter parameterization

I am trying to parameterize my request using CSV Data Set Config. My input includes double quotes("), colon(:) and brackets([])
Eg: fiscal_year ":["2021",2019]"
Had tried with it, but in the actual results its passing as "fiscal_year "":[""2021""
Please share your inputs on what am i missing on the input paramter.
I don't think it's due to double quotes("), colon(:) and brackets([]), CSV stands for comma-separated values so JMeter treats it as a delimiter and reads everything including to the first comma.
So you might want to change the "Delimiter" to something else:
It's hard to come up with a comprehensive solution without seeing at least couple of lines from your CSV file and the way you're parameterizing the HTTP Request with JMeter Variables
In case you have one entry per line in the CSV file it might be easier to go for __StringFromFile() function which reads next line from the file each time it's being called. See Apache JMeter Functions - An Introduction for more information.

JMeter - How can I capture values from Response data and add them in the same CSV results file that is used to generate HTML reports

I need to capture some values from Response data and add them to the same CSV file which is used to generate HTML reports (not to a separate CSV file). The reason I want to do this is to filter the Response times by any value I capture, in this case LOBs or GroupIDs (last 2 columns). In the picture, column A thru P are from JMeter generated results, but I want to add column Q and R also with captured values.
Results
Add a suitable Post-Processor to extract LOBs and GroupIDs, make sure to use exactly the same variable reference name:
Add the next line to user.properties file:
sample_variables=LOBs,GroupIDs
That's it, next time you start JMeter you will see 2 extra columns added to the .jtl results file containing variable values for each Sample Result.
If you don't want to make the change permanent instead of adding the above line to the user.properties file you can pass it via -J command-line argument like:
jmeter -Jsample_variables=LOBs,GroupIDs -n -t test.jmx -l result.jtl
References:
Sample Variables property
Overriding Properties Via The Command Line
Apache JMeter Properties Customization Guide

JMeter CSV Data Set doesn't take the values of the first column

I am using JMeter 5.1.1.
I have a CSV file looks like this
When I call HTTP Request like this
I get this
Jmeter doesn't take the value but just pass the name of the variable to the URI.
But if I take the second column CustomerParam by putting ${CustomerParam} , then JMeter will grab the value (instead of the name of the variable).
I am wondering how can I get the values of the first column ?
Thanks.
I found the root cause.
When creating the CSV file using the newest Microsoft Excel 365 , save it as CSV , not CSV UTF-8.
When I saved the file using CSV, JMeter works perfectly fine. But when I saved it using CSV UTF-8, then the issue I described earlier does appear.
If Variables are referenced as follows:
${VARIABLE}
If an undefined function or variable is referenced, JMeter does not report/log an error - the reference is returned unchanged. For example, if UNDEF is not defined as a variable, then the value of ${UNDEF} is ${UNDEF}.
Input the Variable name in your CSV Data Set Config as follows (If your CSV data set looks exactly above where variable names are present in the first line):
Or, you can just remove the variable names from the first line of your CSV file and make the config as below:
I cannot reproduce your issue using the same CSV Data Set config:
The evidence that the variables have been read (assumes Debug Sampler and View Results Tree listener combination)
So double check the following:
Your CSV file integrity as it might be an issue with the data itself, i.e. if there is a BOM at the beginning - you will have to remove it as the BOM will be added to the first variable name (use aforementioned Debug Sampler and View Results Tree listener to verify which variables are defined)
An problem with the CSV file operating-system wise (i.e. typo in location or file permission issue). Normally JMeter should report any errors connected with failure of reading the CSV file in jmeter.log

Jmeter- How to pass Comma separated String as 1 value through parametrization

From a csv file, I need to pass
224,329,429
as a single value to one of the parameter in HTTP request.
I have parameterized using CSV data config. But, only 224 is getting passed.
I want 224,329,429 to be treated as a single value.
Please let me know how do I achieve this. Should I change anything in CSV config or CSV file to make this work?
Just use __StringFromFile() function instead of using CSV Data Set Config.
The __StringFromFile() function reads next line from the file each time it's being called so it seems to be a lot easier to stick to it for particular your scenario.
The syntax is as simple as ${__StringFromFile(/path/to/your/file.csv,,,)} and the function can be used anywhere in the script, i.e. directly in the request parameter section.
See Apache JMeter Functions - An Introduction to get started with the JMeter Functions concept and comprehensive information on the above and other JMeter functions.
You should change your delimiter to a not used character e.g. #
In that way you will be able to get full line for every request
Use ${__FileToString(dummy.csv,,payloadvar)} function. It makes the file independent that mean you can use any file extension example: .txt, .csv, .excel etc..
Just keep the string in dummy.csv and it will fetch the whole string.
benefit of using this function is, it will not consider comma's so in case your string has comma separated values then this is the best option.
Just use %2C in the place of comma.

JMeter won't read list of quoted, CSVs from a CSV file

Using JMeter to support functional API testing and have run across a problem with reading data from a CSV file. The data from the file is used in building a POST data body which contains something like this:
"wibbles" : ${wibble-var},
${wibble-var} is read from a CSV file and has the format :
["wibble1","wibble2","wibble3"]
... there are over 1000 wibble values in the list.
If "wibbles" : ["wibble1","wibble2","wibble3"]... is hard-coded into the POST body, then JMeter is happy, builds the POST request and does the business, but it's proved impossible to create a CSV file with even the 3 value example above, that JMeter will parse. JMeter skips the thread containing the 'CSV read' without building the POST request or sending it, so there's no response to examine, and a Debug Sampler is similarly skipped. I've heard rumours that doubling up the quotes can work but haven't been able to find the right syntax. Can anyone throw any light on this issue? Thanks
Double quotes will work if you can get "wibble1,wibble2,wibble3" & if you set Allow quoted data to true in CSV data set config
You can get this value and then use beanshell preprocessor to convert to the format "wibble1","wibble2","wibble3".
If you want to get in this format "wibble1","wibble2","wibble3" directly, you can use \t as the delimiter & modify the data in the CSV file accordingly.
Trial and error led to the following solution.
The format of the single data variable I needed to parse is ["value1","value2","value3"] (i.e a JSON array.) and this is exactly what the CSV file contained (with a header name of course on the first row), including the [ and ] brackets.
I modified the parameterised POST body to:
"wibbles": [${wibble-var}],
-- that is, I moved the square brackets out of the CSV file so that the CSV file now just contained the quoted elements of the array:
"value1","value2","value3" etc
I then set the delimiter in the CSV Data Set Config to |
And Allow Quoted Data to FALSE. <--- This was a bit counter intuitive but without it JMeter would not read the whole comma separated list of 2000 quoted strings as a single variable.
With these changes in place the script executed correctly.
Thanks again for the responses, I will definitely look at the __String functions mentioned.
I would go for the following options:
If your "wibbles" are a single string which you need to pass a a JSON Array it might be a lot easier to access them via __StringFromFile() or __FileToString() functions like:
"wibbles" : ${_StringFromFile(/path/to/file/containing/wibbles,,,)},
If you need to access individual "wibbles" and your CSV file is basically a JSON file:
Add HTTP Request Sampler to your test plan (before one which sends these "wibbles") and configure it as follows:
Protocol: file
Path: c:/testdata/yourfile.csv
Add JSON Path PostProcessor and use a JSON Path query to store the "wibbles" into a JMeter Variable(s)

Resources