Configurable number of threads in jmeter ThreadGroup - jmeter

let say i want to test the same http request for 10 users, 25 users ,50 users and 100 users separately and generate a report for each group of users.
One solution is to manually create as many thread group as a number of group of users:
ThreadGroup for 10 users
ThreadGroup for 25 users
...
is there any other solution to create this plan in jmeter?

Define the desired number of threads using __P() function like:
${__P(threads,)}
When you will be running JMeter in command-line non-GUI mode you will be able to pass the number of threads using -J command-line argument like:
jmeter -Jthreads=10 -n -t test.jmx -l 10-threads-result.jtl
jmeter -Jthreads=25 -n -t test.jmx -l 25-threads-result.jtl
etc.

Related

Is there a way to show jmeter load details in Dashboard

I want to print to dashboard report the loading details.
In case of Thread Group:
threads: 100
ramp up: 10
loop: 1
In case of Ultimate Thread Group: the Threads Schedule details
Is there a way to add them to the report?
Dotan
You can rename the JMeter's dashboard to reflect your load pattern, the relevant property is jmeter.reportgenerator.report_title so if you do something like:
jmeter -Jjmeter.reportgenerator.report_title="threads: 100 ramp up: 10 loop: 1" -n -t test.jmx -f -l result.jtl -e -o dashboard
the dashboard title will be changed to the property value:
More information:
Configuring JMeter
Apache JMeter Properties Customization Guide

jmeter running more tests than in CSV list

I'm setup a jmeter test where I've added a CSV Data set Config with a list of IDs that I want the test to go through. The csv file has 10,000 IDs but when its running, it seems to run more than 10,000 tests.
I've set some of these setting as well:
Thread Group
Number of threads: 10
Ramp-up period: 1
Loop count: 1
CSV Data Set Config
Recycle on EOF: False
Stop thread of EOF: False
Sharing Mode: All threads
I then run the test via the cli like this:
./jmeter.sh -f -n -t /home/user/rtf-load-csv-list.jmx -l /home/user/logtest/test.log -e -o /home/userhtml/
when I do a wc -l /home/user/logtest/test.log, I see more than the 10,000 requests but there are only 10,000 IDs in the csv file.
why doesn't it stop after the initial 10,000?
You need to set Stop thread of EOF to True otherwise when all 10000 values will be used JMeter will continue sending the requests with default placeholder of <EOF>
More information: Using CSV DATA SET CONFIG

How to execute specific HTTP request using robotframework

below command will execute all the HTTP request under the jmx file but i want to execute specific threadgroup or HTTP request in jmeter using robot framework.
Below keyword will execute all the threadgroup and HTTP request,
Run Jmeter /home/sadha/Documents/apache-jmeter-5.4.1/bin/jmeter.sh /home/sadha/Documents/apache-jmeter-5.4.1/bin/HTTP Request.jmx ${logPath} -Jvendor=${vendor} -Jurl=${url} -Jport=${port}
For Thread Group - if you dynamically define the number of threads using __P() function in 2 thread groups like:
in Thread Group 1: ${__P(thread.group.1.users,)}
in Thread Group 2: ${__P(thread.group.2.users,)}
you will be able to provide the desired number of threads via -J command-line argument like:
Run thread group 1 with 100 users, don't run thread group 2: /home/sadha/Documents/apache-jmeter-5.4.1/bin/jmeter.sh /home/sadha/Documents/apache-jmeter-5.4.1/bin/HTTP Request.jmx ${logPath} -Jvendor=${vendor} -Jurl=${url} -Jport=${port} -Jthread.group.1.users=100 -Jthread.group.2.users=0
Run thread group 2 with 100 users, don't run thread group 1: /home/sadha/Documents/apache-jmeter-5.4.1/bin/jmeter.sh /home/sadha/Documents/apache-jmeter-5.4.1/bin/HTTP Request.jmx ${logPath} -Jvendor=${vendor} -Jurl=${url} -Jport=${port} -Jthread.group.1.users=0 -Jthread.group.2.users=100
Run both thread groups with 100 users each: /home/sadha/Documents/apache-jmeter-5.4.1/bin/jmeter.sh /home/sadha/Documents/apache-jmeter-5.4.1/bin/HTTP Request.jmx ${logPath} -Jvendor=${vendor} -Jurl=${url} -Jport=${port} -Jthread.group.1.users=100 -Jthread.group.2.users=100
The same approach can be applied to the HTTP Request samplers, if you put them under the Switch Controller and use __P() function as the switch value like ${__P(request,)}:
if you pass -Jrequest="Request 1" - it will execute Request 1
if you pass -Jrequest="Request 2" - it will execute Request 2
etc.
More information:
Configuring JMeter
Overriding Properties Via The Command Line
Apache JMeter Properties Customization Guide

How can I test 50 threads and 60 threads ,for slave 1 and slave 2 respectively from jmeter non gui command?

Scenario :
I have 2 slave machines configured , I want to send 50 users for slave 1, 60 users for slave 2 . I am using non GUI jmeter from command .
IP Address example :
Slave 1 : 1.0.0.1
Slave 2 : 2.0.0.2
Jmeter test plan configuration variables:
Number of threads :${__P(threads1,)}
Ramp-up period : ${__P(threads2,)}
Loop Count : ${__P(threads3,)}
I tried following command on jmeter start, but its not working as per expected:
jmeter -n -t POC1.jmx -R 1.0.0.1,2.0.0.2 -Gthreads1=50 -Gthreads2=1 -Gthreads3=1, -Gthreads1=60 -Gthreads2=1 -Gthreads3=1
Please help me if I am wrong in above command , please tell me how can I send 50 user threads , ramp up period 1 and loop count 1 for slave 1 and 60 user threads ramp up period 1 and loop count 1 for slave 2.
You won't be able to do it the above way as:
All remote slaves are executing the same test plan
You can pass global properties via -G command-line argument, so all the remote clients will be having the same properties set
The solution is to use different user.properties on different slaves, like:
Define amount of virtual users in your Test Plan using __P() function like:
${__P(threads,)}
On first slave add the next line to user.properties file (lives in JMeter's "bin" folder)
threads=50
On second slave add the next line to user.properties file
threads=60
Restart JMeter on slaves
You can also pass threads property value via -J command line argument while starting JMeter servers like:
On first slave
jmeter -Jthreads=50 -s -j jmeter-slave1.log .....
On second slave
jmeter -Jthreads=60 -s -j jmeter-slave2.log .....
See Apache JMeter Properties Customization Guide for more information on using JMeter properties, setting and overriding them

How to generate the total time required for the entire test plan in Jmeter

I have an aggregate report:
Do I have to add another listener or add anything else to the testplan?
For ex: consider the above snapshot:
I'm running 9002 samples, I just need to know the total time required for all the 9002 samples?
If your 9002 Samples are played in a sequence by only 1 user, just use a TransactionController that will contain your HTTP Request and you will have this.
If 9002 samples are played by different users then you can export the CSV file that contains the test results and use Excel to sum up the elapsed column.
To generate a CSV file, run test in NON GUI Mode using:
jmeter -n -l results.csv -t test.jmx

Resources