I tried to import data from a csv file. But it is not working. Can anybody help me?
My csv file:
username,password
usr1,pswd1
usr2,pswd2,
usr3,pswd3
......
.....
My CSV Data Set Config:
File name: D:\Jmeter\Data\Login.csv
Variable names: username,password
Allowed quoted data?:True
Recycle on EOF?:False
Stop thread on EOF?:True
But in the request body the username and password are not reflected
POST data:
__EVENTTARGET=ctl00%24ContentPlaceHolder1%24submit_btn&__EVENTARGUMENT=&__VIEWSTATE=5yDYRGJAvmOFe2yRZWqpXcU%2Fjy4d3kuQN0MiJSPN%2BSjcO4%2BWHatlhSCDH%2FYSsVkXcmaeSOeM5tgjxITgfplBaZdFcWAehSjSj6pCmpSNqI0%3D&__EVENTVALIDATION=rLAwRsfGRJxIUNuCrGNKSRwRWmH8KlXvFg85hbvt%2FUx9fI3qEEImGpMg%2Fi97mHb20kuESntswMVH5c%2BTkET8ludQxvA9%2Bnoz2wV2W4d%2FgcvK0rvRULKQhR4OxiVNJXQq2q3bR1cIUpYOIFbTEOyumwLlATsfrS1eAfuKZ8UEkeY%3D&ctl00%24ContentPlaceHolder1%24username_txt=%24%28username%29&ctl00%24ContentPlaceHolder1%24password_txt=%24%28password%29
I am just elaborating that how to creating\importing data from CSV
1.Create a CSV file in desired path-->D:\Jmeter\Data\Login.csv
Having data like this:-
usr1,pswd1
usr2,pswd2
usr3,pswd3
2.Add the csv data config similler to attached image
3.Use the username and password where you want like below snapshot
Hope it will work for you
Related
I have a question in connection with this problem. I try to import csv file into mysql table but I get this error message: "can't analyze file. "please try to change the encoding type. If that doesn't help, maybe the file is not: csv or the file is empty". I set the coding to utf 8 in excel when I saved the csv file but doesn't work.
Thanks your help guys :)
These are the first three rows of the csv:
I am trying to load json file using json serde. I have added the serde jar file successfully.
1) My json jar file placed on path /apps/hive/warehouse/lib/
I have run this command successfully
add jar hdfs:///apps/hive/warehouse/lib/json-serde-1.3-jar-with-dependencies.jar; converting to local hdfs:///apps/hive/warehouse/lib/json-serde-1.3-jar-with-dependencies.jar Added [/tmp/6f1a54b9-65c4-4e32-8e87-25d60ef775c6_resources/json-serde-1.3-jar-with-dependencies.jar] to class path Added resources: [hdfs:///apps/hive/warehouse/lib/json-serde-1.3-jar-with-dependencies.jar]
2) Now when i am trying to upload json file on this path /apps/hive/warehouse/lib/ or tmp/
using ambari GUI. I am unable to upload it gives error 500. see attached image
3) I have also tried this command but beacuse i am unable to upload json file. so, it doesnot work
hadoop fs -put tmp/test.json /apps/hive/warehouse/lib/test.json
Kindly help me solving this issue
To load the file into hive, first copy the file to an HDFS Location. Like below:
hadoop fs -put /complete_path_to_my_json/json_to_upload.json /app/hive/a_temp_location
Then once you have the table created with JSON SerDe like below:
create table if not exists my_json_table (id int, name string, designation string) row format serde 'org.apache.hive.hcatalog.d.JsonSerDe';
You can load the data into the table with the following statement:
load data inpath '/app/hive/a_temp_location/json_to_upload.json' into table my_json_table;
I have a sample csv file . I have to parse only ip address , port and qid related columns from the csv file. and store it in json format.enter image description here
Please help.
Code:
with open(your csv file)as _file:
ip_addresses = [ line.split()[0] for line in file.readlines() ]
assuming ip address as first column, hence 0 index, also it seems as if your csv requires cleaning up, also csvs are just text files seperated by commas
Please check the below steps I followed in my test.
First, created a CSV file with the username and password. I have done this in a text editor, and saved as .CSV file.
My CSV Looks Like:
username password
user 1 pwd 1
user 2 pwd 2
And I placed in the Specific path and I have mentioned in the same path in CSV Data Set Configuration steps.
File Name : mentioned full path of the file.
Variable names : username,password
Delimiter : ,
Next I Have defined the below changes in HTTP Request
username with ${username}
password with ${password}
After running the test, the passed user logins are not taking from the script and the test got failed.
please guide me if some where am wrong.
Here's how your input file and Jmeter item should look like:
If your CSV file is actually separated by tabulation symbols you need to change the delimiter to \t
I would suggest removing leading "username" and "password" from your CSV file, JMeter won't recognise header so you'll have at least one failed request.
Other bits look good.
You may also want to check out Using CSV DATA SET CONFIG guide and __CSVRead() function.
I have a JMeter setup which reads data from a CSV file configured in CSV Data Set Config element. It works fine, the CSV file is specified in CSV Data Set Config -> Filename.
Now I want to envoke JMeter from command line instead of GUI, and I want to specify a different filename for the above element. How to go about it?
I tried "-JCSVNAME=" but it does not seem to work.
Ideas?
Just use __P function in the Filename field of Listener
Then on command line , add this:
-Jdatadir=full path to folder that contains CSV
Just change the Filename field in CSV Data Set Config to ${__P(datadir)}.
Include the following option while using jmeter.
-Jdatadir=path_to_the_config_csv
Example:
jmeter -Jdatadir=/home/InputData.csv -n -t /home/request.jmx -l some.csv
CSV Data Set Config