I'm testing rest API with Csv data config using 16 digit card numbers,but while execution started cardNo displaying as null in request but I've mention 16 digit card numbers to test.
Why is it not accepting 16 digit card numbers to pass in request using CSV Data Set config?
Card File:
cardno,scode,tNo,txnNo,txn_Date,Amount
1061557318991070,1234,30,40001,15-05-2018,200.60
POST data:
{
"cardNo": "null",
"mobileNo":null,
"sCode": 1234,
"tNo": "30",
"MemoNo": 40001,
"MemoDate": "15-05-2018",
"Amount":"200.60"
}
JMeter's limitation on CSV values is 2+ gigabytes, the fact you're getting "null" most probably indicates wrong CSV Data Set Config setup.
Given:
Your CSV file
The following CSV Data Set Config setup:
I'm able to see all the values using Debug Sampler and View Results Tree listener combination:
Related
I have one GET request which returns a token. I need to run this request 50 times and each returned token is appended to a single file or array which I can randomly choose and use tokens for other requests. Is it possible in Jmeter
Add a Post-Processor to extract the token and save it into a JMeter Variable
Declare the variable as a Sample Variable
Save the extracted value into a CSV file using Flexible File Writer
Use Random CSV Data Set Config to read the random token from the CSV file created in the previous step
I am testing an API using JMeter.
But if I have sent multiple requests it's not working because of user_id show duplicate.
In the Test plan, I add a variable and define value.
Using BeanShell PostProcessor I try to make generate random value.
But all time as I define value not update the random value.
{
"user": {
"user_id": 100113,
"rest_id": 4589445,
"rest_name": "chetan",
}
}
Using HTTP header manager and HTTP Request.
In HTTP Request body I passed this JSON
For a single request, it's working fine.
But if I have sent multiple requests it's not working because of user_id show duplicate.
how can I change every time user_id with the help of JMeter?
Right now I am doing manually. Every time I have to change user_id.
Use this random function ${__RandomString(6,1236547890,)}. It will generate random value of 6 digit each time.
For more details visit below link:
https://jmeter.apache.org/usermanual/functions.html
Use CSV Data sec config to parameterize user id. Input userids in csv then pass the column name of the csv in the json as "user_id": ${USERIDFROMCSV}
For more info on csv data set config use, check link:-
https://guide.blazemeter.com/hc/en-us/articles/206733689-Using-CSV-DATA-SET-CONFIG
Also, there are functions which can be used like Random,RandomString. For more information check:-
https://jmeter.apache.org/usermanual/functions.html
I am using the jmeter for load testing a web application.I am using csv Data Set Config to pass email to test login scenario.While i am running with 100 concurrent users,it is picking same email from csv file.How can i make sure that it will use one email only once.
I was facing the same issue during concurrency testing using CSV data config. By enabling Sharing Mode=All Threads in CSV data config solved my problem and i was able to send unique data per request
Use Random String Function for generation of different email ids,
RandomString function returns a random String of length using characters in chars to use.
It has three parameters,
1. Length of the desired random string
2. Source characters
3. If you need to store generated string into a JMeter variable you can provide variable name as 3rd argument.
${__RandomString(6,a12zeczclk, MYVAR)}
Example as,
${__RandomString(10,abcdefghijklmnopqrstuvwxyz,)}#MyMail.com
In my below code i have to use multiple values in userEmail, userName, userMobile.
How can I do ti using csv config?
{"userDevicedId":"d0lfwViLwLQ:APA91bH4VSXS7VlthXhGQ4DPfb3otSUvwMnpmcK-mKyh7WN46xtDXWSYIOLB6Uw-nYr3zSBZOoiicpNuURQ2nR-a9vtwwSI8sehG-FbgYi4AaCdgurLG5C3Le4sYE0Lmp-piz_STLYnB","userEmail":"Tok#gmail.com","userMobileNo":"8989898995","userName":"Tik","userPasskey":"xmrVhb2MpmuzgLN941tGiLtdJnY3yvgMxlhXATEUa7SvsxclTiMLdJgPs7YTbNHF","userPassword":"Test123$$"}
Given your CSV file looks like:
someone#example.com,someone,1234567890
someoneelse#example.com,someoneelse,2345678901
etc.
Configure CSV Data Set config as follows:
Filename: full path to the CSV file
Variable Names: userEmail,userName,userMobile
Other config values - according to your scenario, see Using CSV DATA SET CONFIG guide for detailed explanation
Refer extracted values like ${userEmail}, ${userName}, etc. where required, i.e. if you want to send parametrised JSON it should look like:
{
"userDevicedId": "d0lfwViLwLQ:APA91bH4VSXS7VlthXhGQ4DPfb3otSUvwMnpmcK-mKyh7WN46xtDXWSYIOLB6Uw-nYr3zSBZOoiicpNuURQ2nR-a9vtwwSI8sehG-FbgYi4AaCdgurLG5C3Le4sYE0Lmp-piz_STLYnB",
"userEmail": "${userEmail}",
"userMobileNo": "${userMobile}",
"userName": "${userName}",
"userPasskey": "xmrVhb2MpmuzgLN941tGiLtdJnY3yvgMxlhXATEUa7SvsxclTiMLdJgPs7YTbNHF",
"userPassword": "Test123$$"
}
If you're using HTTP Request sampler, switch it to "Body Data" mode:
Remember that CSV Data Set config reads next line each iteration so make sure you provide enough loops on Thread Group level or via Loop Controller
I am using JMeter for load Testing my Application .
As part of payload i am sending 3 parameters to the REST Webservice call
ordersplitjson = {"highPriceVendor": "VC4 Raj","vendors": {"T1": [{"item_ids_": "194","leaf": [{"orderid": "14101519","cust_id": "22"}],"vendor_id": "9"}]}}
customer_id = 22
homedelivery = Yes
I am loadtesting the Application with 100 users with a Ramp Time for 2 seconds .
This is the way i have configured and this works fine for static payload
As part of load Test , i want to login as different user for every request
(Means for every request i want to send different parameters )
I guess i cant use CSV DataSet Config as i have a JSON as a payload
could anybody please let me know how to achive this load test with different payloads
You should still be able to use CSV Data Set Config by following one of below approaches
Option 1: change "Delimiter" from default comma `,' to something else which won't be in your JSON payload, i.e. | , put your JSON payloads into CSV file and use them as it.
Option 2: You don't necessarily need to have the full JSON in the CSV Data Set element, it can be configured to read multiple values into multiple variables, i.e. your CSV file will be something like
VC4 Raj, T1, 194, 141519, 22, 9
And Variable Names in CSV Data Set Config will be
highPriceVendor, vendors, item_ids_, orderid, cust_id, vendor_id
In that case you can configure your request body as:
{"highPriceVendor": "${highPriceVendor}","vendors": {"${vendors}": [{"item_ids_": "${item_ids_}","leaf": [{"orderid": "${orderid}","cust_id": "${cust_id}"}],"vendor_id": "${vendor_id}"}]}}
See Using CSV DATA SET CONFIG guide for instructions on the second approach.