nested loop with file1.csv and file2.csv in jmeter - csv

I am using Apache JMeter and I need to run function call in 2 nested loops driven by csv datafiles. There is similar Q&A at How to implement nested loop in jmeter? but it's not based on datafiles.
I have 2 files:
long.csv:
1
2
3
...
100.000
and short.csv:
a
b
c
I need to run nested loop test with data from those files
foreach x from long.csv
foreach y from short.cvs
call(x,y)
and I want the calls look like this:
call(1,a)
call(1,b)
call(1,c)
call(2,a)
call(2,b)
call(2,c)
call(3,a)
call(3,b)
call(3,c)
...
call(100000,a)
call(100000,b)
call(100000,c)
The calls may be reordered, but I need unique call on every combination of inputs.
Suggestions?

If you are looking for detailed steps, please check here.
http://www.testautomationguru.com/jmeter-looping-2-csv-files/
I tried & it seems to work - Please check below snapshot for details.
CSV Data set Config 1 reads a csv file - the var ref name is 'vara'.
it has 10 rows , 1-10
CSV Data set Config 2 reads another csv file , contains 3 rows a, b c - and the var ref name is 'varb'. 'Allow ReCycle on EOF?' is set to True.
Thread Loop Count is for CSV Data set Config 1
Inner Loop Controller's loop count is for CSV Data set Config 2

Related

How to execute ForEach loop 100 times in Jmeter?

I have a thread group with loop count set to 5. Inside it, I have used a JSON extractor with 1st request which creates a total of 100 variables with purchaseOrderId_1 pattern. I used it in ForEach controller next so the loop shoud execute 100 times ideally. Inside the ForEachLoop, I have a while controller, which executes the child requests 5 times until all the 5 rows of data in Csv Dataset config is read. The goal is to run the 3rd request 5 times for one value of output variable of ForEach controller and in the end, 500 times for the 100 values. The 3rd request should run 2500 times in total. But, the test stops after executing the 3rd request 5 times only for purchaseOrder_1.
Screenshot of my test plan flow.
There is quite a lot of nesting. I tried to interpret your statements and created a test plan. Please check if this is the requested pattern you are expecting.
This is the Sample JMX
CSV File csv
Note: Update CSV file path after you download both the files

how can we create a block size in jmeter with csv config? Each thread should pickup specific set of values

how can we create a block size in JMeter with CSV config?
I have 5 multiple users and one Bulkuser.csv file with 4 columns,
The file has around 2000 values.
I wish to create a block of 400 values for my 5threads[users].
1st USER WILL USE 1st – 400 VALUES (Values in ROW 1-400)
2nd USER WILL USE NEXT 5 VALUES (Values in ROW 401-800)
and so on..
How can we implement this? is there a beanshell pre-processor script for each data read and decide to read the specific file as per thread number?
As of JMeter 5.3 this functionality is not supported, the only stable option I can think of is splitting your Bulkuser.csv into 5 separate files like user1.csv, user2.csv, etc. and use __threadNum() and __CSVRead() functions combination for accessing the data like:
${__CSVRead(user${__threadNum}.csv,0)} - reads the value from column 1 from user1.csv file for 1st thread (for 2nd thread it will be user2.csv file, etc)
${__CSVRead(user${__threadNum}.csv,1)} - reads the value from column 2
.....
${__CSVRead(user${__threadNum}.csv,next)} - proceeds to the next row
More information: How to Pick Different CSV Files at JMeter Runtime

JMeter : Using multiple CSV files

The following is the scenario I want to run in JMeter: I have one CSV file (file1.csv) containing 100 userIds and passwords. I have created a Thread Group containing 100 users. I want each user to read one row of userId and password from file1.csv. For this I have added a CSV File Config element. Now, I want each of these users to read dynamic CSV file (for first row of userId and password from file1.csv it should read file2.csv, for
second row of userId and password from file1.csv it should read file3.csv, for third row of userId and password from file1.csv it should read file4.csv and so on ) containing some rows. Each row contains parameters for a HTTP request.
Can anyone tell me how to do this in JMeter?
I am generating the one csv file(file1.csv) containing user name and password and other csv files(file2.csv,file3.csv,file4.csv and so on) containing some records.
The easiest solution would be adding a Counter test element or __counter() function to generate incrementing postfix for secondary CSV files on each iteration and using __CSVRead() function for extracting data from your file1.csv, file2.csv, etc.
See How to Use JMeter Functions posts series to learn more about using functions in JMeter tests

SSIS_Get count of rows from source and load to destination

I have two OLEDB sources such as
DB Source1= select count(*) from A
DB Source2= select count(*) from B
Now, I need to get the count of Records uploaded
DB Source1 -DB Source2
for eg,
DBSource1 = 9 ;DBSource2= 1
then record uploaded will be 9-1=8
Finally I need them to be loaded to a flat file destination with following columns
RecordsReceived ErrorRecords RecordsUploaded
9 1 8
How do I achieve this?
TIA :)
You should look into the Row Count Transformation task. This one will count your selected records that flow through it and store it in a variable you declared. You can use those variables later in your script to store them in a flat file.

Running a thread group multiple times for all the values in a csv file

I have recorded a series of 5 HTTP requests in a thread group (say TG). The response value of a request has to be sent as a parameter in next request, and so on till the last request is made.
To send the parameter in first request, I have created a csv file with unique values (say 1,2,3,4,5).
Now I want this TG to run for all the values read from the csv file (In above case, TG should start running for value 1, then value 2, till 5).
How do I do this?
Given your CSV file looks like:
1
2
3
4
5
In the Thread Group set Loop Count to "Forever"
Add CSV Data Set Config element under the Thread Group and configure it as follows:
Filename: if file is in JMeter's bin folder - file name only. If in the other location - full path to CSV file
Variable Names: anything meaningful, i.e. parameter
Recycle on EOF - false
Stop thread on OEF - true
Sharing mode - according to your scenario
You'll get something like:
See Using CSV DATA SET CONFIG guide for more detailed explanation.
Another option is using __CSVRead() function
This method of creating individual request for each record will not be scalable for multiple records. There is another scalable solution here - Jmeter multiple executions for each record from CSV