CSV data set config
Now we will bulk register customers by reading from a CSV file
Create a file in bin folder named “customers.csv”
Prepare customers.csv file like that:

Now, Right click on Simple Controller and click on Add > Config Element > CSV Data Set Config
Set following configuration:

variable names are the customer properties
Now disable the jr223 PreProcessor as we will not use it right now

Then disable also the following HTTP Requests as these are currently not needed

Now, select Thread Group and set Thread as 5 because we will bulk create 5 customers from our CSV

Now clear previous history and run the project
You will see first 5 customers has been created

Perform Load Test from CLI (Command Line Interface)
Now disable CSV data set config and enable all our previous simple controllers and HTTP Requests
Go to your bin folder and open with command prompt
Then hit following command:
jmeter -n -t load-test-demo.jmx -l load-test-demo.csv
-n specifies non gui mode
-t specifies configuration file
-l specifies log file that will generate by jmeter
log file extension can be csv, xml or jtl

Hit enter and the load will be execute. You will see the summary result in console window

Troubleshooting
If jmeter is not recognized by the command prompt, then set jmeter home from Environment Variables

and add path

Now if you hit the command jmeter, it will no more show the error and will open the JMeter
Generate Report
Now we will generate a html report so that our load test result is more clear
Delete the “load-test-demo.csv” generated in bin folder
Hit following command in cmd
jmeter -n -t load-test-demo.jmx -l load-test-demo.csv -e -o Reports

A folder named “Reports” will be generate in bin folder

Open the index file and and you will see a result has been generated

When you need to generate the html report again, delete the log file “load_test_demo.csv” and Reports folder and hit the command again
Distributed Load Test
Distributed load test is a process where master computer and multiple slave computers are connected each other and the master computer command the slaves to execute load together
First you have to LAN connect 3 computers and disable firewall
Make sure that every computer can ping each other
suppose,
pc-1 IP: 192.168.0.101
pc-2 IP: 192.168.0.102
pc-3 IP: 192.168.0.103
Now we will configure our JMeter
Go to JMeter bin folder and find out jmeter.properties file
open the file and find “remote_hosts”
Remove the “#” and edit this line:
remote_hosts=192.168.0.101,192.168.0.102,192.168.0.103
Now start the jmeter-server.bat in the slave pc’s
suppose, pc-2 and pc-3 are our slave pc
Then from the master pc, go to bin folder and open CMD
Then hit following command:
jmeter -n -t script.jmx -r //run all server
or
jmeter -n -t script.jmx -R 192.168.0.102,192.168.0.103 //run specific server
Here’s the full project:
https://github.com/salmansrabon/jmeter-test-file
Leave a Reply