jmeter not saving variables into CSV or XML files - jmeter

I'm new to jmeter.
I understand that I can edit jmeter.properties and specify the names of "custom" variables that jmeter will save into its output files, for any given test run.
I've edited jmeter.properties to include this line:
sample_variables=DURATION
and I've also edited my test plan to include a Regular Expression Extractor that extracts a value from each response and stuffs it into a variable of that name.
I also added a "Simple Data Writer" to tell jmeter to write the data it collects to a file.
The output file gets created successfully, but it does not contain the variable I extracted.
What am I doing wrong?
I'm finding this impossible to google, because "save jmeter variable" doesn't constrain the situation nearly enough.

My bad.
Jmeter was writing that variable out.
I had to restart jmeter to get it to work.
I was misled by looking at the top of the output file - it contained output from a prior run, prior to my restart of the tool. After I Removed the existing output file, the new content in the output file showed the variable I expected.

Related

Failing to reference CSV variables

I've put connection configuration into a csv data set so we can load a different configuration on different environments.
I've put the CSV Data Set Config as the first element under my test plan, with shared mode for all threads.
I've added the Debug Sampler to see if the content of the csv is parsed correctly and I'm seeing it ok. Even though, as u can see in the screenshot, is failing to resolve the variables when they are used?
I've also tried to put manually the Variable Names but I get the same response.
You need to show your CSV file (at least first 2 lines) and Debug Sampler output in order to get comprehensive help
Can it be a typo like the variable is ${CONTEXT_FACTORY} and you're having it as ${CONTEX_FACTORY}?
If your CSV file have header row with the variable names - set "Ignore first line" to False, otherwise you need to provide the variable names, one per "column"
On a one-liner like some context factory the following setup should work:
Demo:
More information: Using CSV DATA SET CONFIG

Using flexible file writer in Jmeter produces unwanted results in the output csv

I am using the flexible file writer in Jmeter to write the four variables that I have captured and defined in the properties file. I have used the debug sampler to verify and view results of the values of each of the 4 variables that I have used.
But when I am trying to use number of threads as more than 3 or 5, I am getting garbled and multiple values of the variables in the same column of the output csv as:
But ideally I am expecting the result to be like:
Timestamp_Queued|Timestamp_Download_Started|Timestamp_Download_Completed|Timestamp_Completed
1623596826050 1623596829514 1623596829868 1623596830045
1623596826195 1623596826434 1623596826840 1623596827071
1623596826427 1623596827736 1623596828138 1623596828319
1623596826629 1623596830096 1623596830417 1623596830600
1623596826809 1623596827113 1623596827514 1623596827692
Can someone help please. I have tried using other JS to capture the data one below the other but I am not able to capture the data in the above way. I am sure Jmeter must have an easy way to accomplish this.
Thanks!
We cannot help you by looking at the screenshot of the result file, we need to see your configuration of the flexible file writer, know how do you launch your JMeter script, is there any suspicious entries in jmeter.log file, etc.
Given that:
You declare your variables as Sample Variables
Configure the Flexible File Writer to save these variables as variable#0,variable#1,etc
Run JMeter in command-line non-GUI mode
You should get the anticipated results
More information: Using the JMeter Flexible File Writer Plugin

How to log regular expression extractor value in results when ran through blazemeter

How to log regular expression extractor value in results when ran through blaze-meter
If you're a BlazeMeter customer it could make more sense to contact BlazeMeter Support, most probably you will get more quick and professional response than trying to ask random people over the Internet for their opinions.
Whatever. What do you mean by "log"?
If you need to write the value to jmeter.log file - just add __logn() function somewhere in your script like:
${__logn(My variable value is: ${foo},,)}
replace ${foo} with your actual variable name
Once test finishes you will see the variable value in the jmeter.log file (you can download it as a part of artifacts.zip bundle from your test Execution Logs
If you want to track the variable value per each sampler - the easiest option is to configure Sample Variables property and provide your variable value there:
this way you will see an extra column in the kpi.jtl file containing your variable value
Artifacts view containing kpi.jtl and jmeter.log files

Getting inverted commas appended in request while reading from csv in Jmeter?

I was trying to read csv file using csvdata config element in jmeter so as to test multiple logins but when I try to read the value from csv file then I get inverted commas appended with respect to result. Please tell me how to get rid of these commas being passed in the request parameters
Please find my csv data config and excel file and request parameter screenshot in attachments
JMeter normally doesn't add anything to the variables, most probably you have the quotation marks in the generated CSV file, open it with normal text editor like Notepad and use find-and-replace feature to remove the quotation marks from there.
If you cannot efficiently control the CSV data you can use __strReplace() function in order to remove the quotation marks from the variables originating from the CSV Data Set Config on the fly like:
${__strReplace(${Username},\",,)}
Demo:
You can install __strReplace() function as well as other Custom JMeter Functions using JMeter Plugins Manager
I had the same issue when I opened a csv file as a normal text file, I saw a Values, value2.
After removing it, it started working as expected.

Saving a jmeter log output as multiple file types at once

I'm running jmeter on a continuous integration platform from a repository and I need to generate both an xml .jtl file and csv .jtl file. Right now I am using -Jjmeter.save.saveservice.output_format=xml and a simple data writer writing to a csv file, but the csv file ends up not being formatted very well and same http calls on load tests don't get combined. If I could create log files for both that would be ideal.
What you’re doing looks correct to me.
What do you mean by csv not being formatted correctly ?
You could invert it by keeping output as csv and add a View Results Tree with filename set and in configure button, ensure you check all fields you need.
Of course, do this only in Non Gui mode.

Resources