How to run multiple scripts of Jmeter in a batch - jmeter

I am using the Jmeter tool for the performance testing.
We have recorded the scripts for each scenario and now we would like to run them in a group in order to simulate the real time scenario.
Could any one please let me know how can we run all the scenarios in one go? Is there any procedure to group all the scenarios that I have recorded and give load on the sever at same time?
Please let me know the steps if any.

You can create a single file with one thread group for each scenario, and set the testplan to run concurrently.

If your test plans are all separate currently and you want to keep them that way, there's always the option of a second device (or a third, or a fourth...). You won't have a single consolidated report of performance -- but you will get the performance for each plan you run separately.
This can also be a good option if,
a) One load client can't produce enough of the desired load for all your test plans running at once, and
b) you don't want to use the Remote Testing features of JMeter to run the test plan from multiple load clients at once.

Let me share my solution for the same problem.
For running multiple .jmx files I have:
folder with all the jmx filed grouped as needed
runner - batch file with the following:
dir ..\Jmx\*.jmx /s /b /A:-D > ..\runner\data.txt
for /F "tokens=*" %%A in (data.txt) do %JMETER_HOME%\jmeter -n -t %%A -Jusers=10 -Jrampup=5 -Jloop=10 -Jport=[port] -Jserver=[server] -l [folder]\Results.csv
exit
see general structure

Related

Problem with Ultimate Thread Group in JMeter

This is what I expect:
expected
and this is what I get:
actual
Any ideas what I'm doing wrong?
I created separate project with dummy sampler and I've got the following Result!?
Test was run from cmd with the following command:
jmeter -n -t "C:\jmeter\_proj\DummyTest.jmx" -l "C:\jmeter\_proj\UltDummyTest01.jtl" -j "C:\jmeter\_proj\UltDummyTest01.log" -Jdatafile=data/Users1000.csv -DTHREADSADD=200 -DSTARTUP=10 -DSHUTDOWN=10 -DD1=0 -DD2=100 -DD3=200 -DD4=300 -DD5=400 -DH5=200 -DH4=400 -DH3=600 -DH2=800 -DH1=1000
Here is the solution on google drive
Ultimate Thread Group should be precise enough, there should be other factors which shorten ramp-up time and overall test duration and your two partial screenshots don't tell the full story.
Make sure to run your JMeter test in command-line non-GUI mode, 1000 threads is way too much for the GUI-based test execution
Make sure to follow JMeter Best Practices
If you're using Precise Throughput Timer or Throughput Shaping Timer check its settings
Check jmeter.log file for any suspicious entries
In case of problems update your question with jmeter.log file and schematic view of your test plan (Tools -> Generate Schematic View)

JMeter tests in Non-GUI mode are not trustworthy

The test scripts on GUI works perfect but not in the non-GUI mode.Image showing Terminal test execution
Explanation:
I have 3 thread groups in the test plan, where the first Thread Group creates 3 .csv files and are expected to feed the data in the CSV files into the second Thread Group.
For few test runs, Non-GUI mode worked great but then, the tests Intermittently like this [Terminal showing test run], doesn't create the CSV files at all and also,
sometimes, third Thread Group doesn't execute at all.
The problem I noticed is:
During the NOn-GUI tests the files are not been creating, so that's the reason the next Thread groups weren't able to pick up and use the variables inside CSV file and also
The second One could be: I'm saving folder and file paths in the
${__setProperty(prop_folder_Path,${File_Path})} and getting the prop.
${__property(prop_folder_Path)} in another Thread Group -> Sometimes this property function Doesn't work and files are saving in /bin Directory
Is there a way to use ${__property(prop_folder_Path)} value in BeanShell POStProcessor ?
I believe whatever works in the GUI should work same in the Non-GUI too, AM I right?
I Just noticed that output files are creating in /bin folderas shown here while running the tests in NOn-GUI
Any suggestions to fix this. Thank you
My expectation is that your ".csv" files creation fails somewhere somehow therefore 2nd thread group is not able to operate due to missing files.
JMeter doesn't have any build-in functionality to write something into the file so I think you implemented some custom logic using i.e. JSR223 Scripting which doesn't work. The reasons could be in:
If you're running JMeter from another folder the .csv files can be created in a different location, try using full paths just in case.
Non-GUI mode tends to be faster than GUI mode so it might be the case of multithreading issue i.e. when multiple threads are trying to write data into the same file concurrently and clash or produce not well-formed data.
In both cases the answer will live in jmeter.log file, check it for any suspicious entries and fix the causes.
In general using files to pass data between thread groups is not the best idea, I would recommend doing it in-memory instead, for example:
In 1st Thread Group use __setProperty() function to convert your data which you store in CSV file into JMeter Properties like:
${__setProperty(foo,bar,)}
In 2nd Thread Group use __P() function to read the data like:
${__P(foo,)}
More information: Knit One Pearl Two: How to Use Variables in Different Thread Groups

jmeter - Clean up previously saved files before running a new test plan

I have been using the following BeanShell script in order to delete all output files before each new run of a test plan
import org.apache.commons.io.FileUtils;
FileUtils.cleanDirectory(new File(vars.get("OutPutFolder")));
My test plan consists of a Thread group that is using 100 users (number of threads) with a loop count of 5.
I have tried several ways to incorporate the aforementioned beanshell script but i cannot seem to find the right place to put it in.
Things that i have already tried:
Creating a new "setup thread group" ("Run thread groups consecutively" is checked)
and place script in a beanshell samples > Files do get deleted but outcome files are not persisted to the disk (re-deleted by my script)
and place script in a beanchsell PreProcessor > Files do not get deleted
Placing script in my main Thread group > Files do get deleted but outcome files are not persisted to the disk (re-deleted by my script)
Using an If Controller (${__BeanShell(vars.getIteration() == 1)} && ${__threadNum} == 1)
Not solving your problem, but based on your comment, here's a different simple solution, which provides you with ability to separate current test results from previous test results.
All the listeners in JMeter can accept a dynamic file path, and one of the dynamic values they can use is TESTSTART.MS property (see here), which will be different for each test execution.
So in order to make name of each output file (or report) unique for the run you can use that property in the name of the output file:
your/path/${TESTSTART.MS}_errors.csv
You can even create a sub-folder holding set of the output files for specific execution, like this:
your/path/${TESTSTART.MS}/name1.ext
your/path/${TESTSTART.MS}/name2.ext
That way the names never collide, and they are grouped by execution (all files from the same execution will have the same timestamp, so you can filter them).
On top of that, on linux you could use logrotate to zip old jmeter logs (and since they are just text files, they zip nicely)

JMeter set number of users in thread group from command line/CSV file

I would like to have my tests parametrized so I could run the very same test with different number of users. I know that I could define some user-variable in my test plan, but I would like a solution which would be more friendly for a regular user (who doesn't know JMeter at all).
I've tried using CSV configuration but it appears that I cannot inject (${numberOfUsers}) into thread group. Is there any workaround? Maybe I could pass number of users when running my test from command line?
Ok, turned out to be really easy-peasy. Instead of acutal users number I set something like this ${__property(myPropertyName)} in my thead group in JMeter. Then I run my tests like :
jmeter -t path/to/test.jmx -JmyPropertyName=10
And the test group would have 10 user.

Simulate millions of users with JMeter

I have a system that should be able to handle millions of users requests concurrently. In order to check how the system handles the load, I setup a cluster of JMeter servers (slaves), and one controller (client).
I have a database of all users (~10M), and I need each request sent to be from a different user.
I am wondering how I can implement such a thing in JMeter. Basically, I thought about dividing a range of users (let's say 100,000) per each slave, and then within a given slave, each request should read a new user from the local 100,000 list, and delete it. Thus, I will eventually send a request from every user.
The thing is while this idea sounds logical theoretically, I do not exactly know how to implement it using the JMeter terms. Also, I am not sure how to read from database in the test, although I could theoretically read it in advance into a text file, and have each slave contain the text file with its 100,000 users portion.
I can setup a very large cluster of machines, so scale will not be the issue here. Just how to set it all up.
The best way to provide Jmeter with a list of parameters is to use a CSV file:
http://jmeter.apache.org/usermanual/component_reference.html#CSV_Data_Set_Config
You can configure the CSV dataset config to do make every thread use a different line in the CSV. Each engine will need to have it’s own unique CSV file, because the sharing mode does nto work between engines in distributed testing (you can try to automate this part, this can be interesting to do :) ).
This is how your script should look like:
1. Thread Group
1.1 HTTP sampler (login)
1.1.1 CSV dataset config
1.2 second http sampler
etc...
The login sampler will use the parameters loaded by from the CSV file, so for every ’login’ it will use a different line.
Distributed testing is pretty simple:
http://jmeter.apache.org/usermanual/remote-test.html
Keep in mind that running 100K concurrent users on a single Jmeter load engine will be hard (Jmeter consumes resources on the server, so you will need lots of CPU and memory). So you should also monitor the engines.
Also 1M users will cause a lot of data that the engines will send back to the console, so you might need to start a bunch of distributed tests in parallel, and at the end aggregate the results.
Cheers,
This is can be implemented by doing the following steps:
Taking the user credential dump and saving it to a csv file
split the csv file. copy 1 file to each Jmeter slave, in the same location on all the
machines e.g. "C:\Loadtest\"
from the controller, give the path of your csv file in "CSV Data Set Config".
Run the Test.
By doing the above steps, Jmeter controller will start execution of the test by pointing all the Jmeter Slave nodes to use the CSV file in the same location "C:\Loadtest\".
But the trick here is that all the machine will be using different set of users.
Hope this will help.

Resources