When using JMeter from the command line, I get the following error in my log:
2014/08/05 14:29:43 ERROR - jmeter.config.CSVDataSet: java.io.FileNotFoundException:
/home/stew/YOU_FORGOT_TO_SPECIFY_USERS_CSV_FILE.csv (No such file or directory)
The user.csv file is in the same directory as the testplan.jmx file. Is there an option to specify the file in the command line?
Regards,
Wolf
If you use relative file name for path then it should work, as per reference documentation:
Filename Name of the file to be read. Relative file names are resolved with respect to the path of the active test plan. For distributed testing, the CSV file must be stored on the server host system in the correct relative directory to where the jmeter server is started.
For another solution, Have a look at :
http://jmeter.apache.org/usermanual/functions.html#__P
You use this function in CSV dataset :
${__P(resdir)}
and on command line:
-Jresdir=your path to csv file
I was using Jmeter to test load Moodle and used options -Jresdir and -Jusersfile options to pass usersfile name
Related
I want to pass relative path file name in csv config element in jmeter.i have used ./filename.csv but the jmeter script doesn't work .I have also used ../filename.csv but jmeter script doesn't work.
Need resolution to pass relative path file name in csv config element in jmeter.i have used ./filename.csv but the jmeter script doesn't work .I have also used ../filename.csv but jmeter script doesn't work.
Relative to what?
As per CSV Data Set Config documentation:
Relative file names are resolved with respect to the path of the active test plan.
csvdata.txt and ./csvdata.txt - then these are treated as different files
If you have filename.csv in the same directory as your .jmx test plan - just use filename.csv, the ../filename.csv construction will look for the filename.csv file in the parent folder for the active test plan.
If you want to know the full path to the current base directory - look for FileServer entry in the jmeter.log file
INFO o.a.j.s.FileServer: Set new base='/this/would/be/the/base/for/relative/CSV/file/lookup'
you will see where JMeter tries to load the CSV file in the same jmeter.log file
I have a CSV File whose location is going to change later. Using Jmeter how can I still read the file even if the location change?
You can set the location of the CSV file as a JMeter property and pass it through the command line or through user.properties file
Set the file name with a property in the CSV Data Set Config element
${__P(full-path-to-file,/Users/hansi/Documents/test-data/test-data-users.csv)}
Note: A default value /Users/hansi/Documents/test-data/test-data-users.csv is set in the above screenshot.
2.Define the value
2.1 In user.properties file
full-path-to-file=/Users/hansi/Documents/test-data/test-data-users.csv
or
2.2 Set the property when JMeter test is executed from commandline
./jmeter.sh -n -t test-plan.jmx -Jfull-path-to="/Users/hansi/Documents/test-data/test-data-users.csv"
If the CSV file is going to change location then you could store the test plan which is using the file alongside it. This would maintain the context of the test plan if the CSV itself is going to be moving by storing them together. In JMeter relative file names are resolved with respect to the path of the active test plan (based on the official documentation), allowing you to specify only the name of the file in the CSV Data Set Config Filename property.
Is there any way to parameterize the CSV data file path or source directory path in JMeter?
There are at least 2 possibilities:
Via User Defined Variables like:
and then referring the variable in the CSV Data Set Config
Or via __P() function like:
the property value can be passed via -J command line argument or put into the user.properties file. See Overriding Properties Via The Command Line for more information.
http://blazemeter.com/blog/how-performance-test-upload-and-download-scenarios-apache-jmeter
I've used above link for reference.
I'm Using Save Responses to a file with Download call.
But fail to Download file.
Can anyone tell me What Exactly i need Specify in
FileName Prefix:
Variable name :
and where to Specify download location ?
Provide absolute file path with a file name.
FileName Prefix: c:\workspace\jmeter-download\myfile
For ex: If your test is downloading a pdf file, you would see a 'myfile.pdf' under 'c:\workspace\jmeter-download'
I've used path like D:/xyzFolder/filename as Filename Prifix
it's working fine for me
and if any one wants file to download in same Dir in which your jmx file is
then just need to use ~/pre as Filename Prifix
I am creating a HTTP Request Sampler in JMeter to automate uploading file to a http service. Is there a way to set the "File Path" in the "Send Files With the Request" to a relative path from the location of the jmx file?
Yes. (This was confirmed in JMeter v2.9)
You can use the following BeanShell expression in the filename input field:
${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}${__BeanShell(File.separator,)}<YOUR FILENAME HERE>
So if your file, "upload.jpg" was located in the same folder as your JMX test file, the complete value would be
${__BeanShell(import org.apache.jmeter.services.FileServer; FileServer.getFileServer().getBaseDir();)}${__BeanShell(File.separator,)}upload.jpg
To keep it a bit cleaner, add a "User defined variables" config element where you assign the base of the expression to a variable e.g
SCRIPT_PATH = ${__BeanShell( ...etc
Then your file path input value would read a more readable:
${SCRIPT_PATH}upload.jpg
I'm under version 2.11, and the BeanShell script didn't work for me, to make the CSV file relative, and so to make a relative path you simple need to use this ~/filename.csv. This would mean that the CSV file exist in the same directory as the JMX file. But I guess you can modify it to this for example ~/../results_dir/filename.csv etc..
Good luck.
I found the answer here http://kisbigger.blogspot.com/2013/09/pointing-to-files-with-relative-paths.html which was ...
step 1: Create a user-defined-variable Config element to your
project.
step 2: Add a new variable CONFIG_PATH
step 3: in the value
column place this code : ${__BeanShell(import
org.apache.jmeter.services.FileServer;
FileServer.getFileServer().getBaseDir();)}
step 4 : use the variable
name wherever you want like ${CONFIG_PATH}\config.xml
having a filename.csv in the same folder as the jmx and putting ~/filename.csv with JMeter 2.11 and a newer JAVA did not work