JMeter slaves are not reading property file values - jmeter

I am running jmeter distributed test. I have lot of combinations to test, so created property files (.properties) to execute different tests.
For example:
I have 1 master and 2 slave machines. I have kept jmx script in master machine and test data in all slaves
Started jmeter-server in all slave machines
Ran distributed test from master with following command
"jmeter -n -t script.jmx -p condition1.properties -R SlaveIP1,SlaveIP1 -l results.jtl"
Results:
Test runs well but with default values defined in script. In my case test duration defined in script is 300 secs whereas test duration in condition1.properties file is defined as 900, but test always runs for 300 seconds.
This is just an example, I have many other parameters defined in property file and should be picked up while running the test.
This problem is happening only in case of master & slave condition, otherwise running test from single machine picks up all values defined in property file.

According JMeter list of command-line options you can't use -p in the case of disturbed testing, but use -G instead.
-G, --globalproperty <argument>=<value>
Define Global properties (sent to servers)
e.g. -Gport=123
or -Gglobal.properties

Related

Jmeter distributed testing master as 2 clients

i want to perform distributed testing on a couple of slaves machines with different purposes and use the same master for that.
the problem is that it's not working good together. for example: i have 3 slaves who are responsible to execute test plan X and i have 3 slaves who are responsible to execute test Y.
when i invoke just test X or just test Y the master and the slaves works fine, but when i try to invoke test X and then test Y the later get close immediately.
i guess that it's because the rmi port is used by the previous test.
is there any when to configure the properties file so i can execute both test X and test Y?
You cannot run more than one test at a time on a given slave.
If your slave machines are powerful enough you can launch 2 different slaves processes on different ports like:
Start slave process #1 on port 1111:
jmeter -Jserver.rmi.port=1111 -Djava.rmi.server.hostname=10.20.30.40 -s
Start slave process #2 on port 2222:
jmeter -Jserver.rmi.port=2222 -Djava.rmi.server.hostname=10.20.30.40 -s
Now you can specify on master on which slave you want to execute the current test like:
jmeter -Jremote_hosts=10.20.30.40:1111 -r -n -t test1.jmx will start test1 on first slave instance
jmeter -Jremote_hosts=10.20.30.40:2222 -r -n -t test2.jmx will start test2 on second slave instance
and these may go in parallel
More information:
Remote hosts and RMI configuration
How to Perform Distributed Testing in JMeter
Overriding Properties Via The Command Line

Jmeter - How to execute tear down thread group only after shut down of main threads in all the slaves?

I am using Jmeter 5.1 and Windows 10.
In my test plan I have main thread and tear down thread and I am running this across two Jmeter slaves, In my test plan I have selected execute the teardown threads only after shutdown of main thread group, it works but it only works to that slave, it doesn't look for other slaves was it still running the main threads or not?.
Could you please tell me a way, I need to execute the tear down thread group only after shutting down of all the main thread groups in all the slaves.
Please help.
Thanks,
Rafiq
This happens as slaves are confined to the JVM where it runs. A copy of test plan is shared with the salves (servers) and they are executed independently and send test result to the client.
You may create a token MAIN_TEST_COMPLETED in a share file accessible by the slaves and check the status of the token before executing the TearDown Thread Group. While controller can be used to wait till the main threads are completed.
Hope this is useful for your requirement.
I used another way, I created one more script and added the first script and second script execution through command prompt so that when the first script is done than the second command will be executed and it executes the test script which is the tear down part.
For Example, I created a bat script like the one specified below and that solves the problem
jmeter -n -t mainscript.jmx -l result.jtl -r
jmeter -n -t teardownplan.jmx -l teardownresult.jtl -r

Jmeter run 2 test plans sequentially command line

I have 2 test plans for 2 different processes that I want to test using Jmeter; both scripts are implemented and can be run individually via the Jmeter GUI.
However, is it possible to run one test plan using the command line, and then once the first test plan finishes, the second test plan gets kicked off. Basically, I want to run one test plan after another: NOT at the same time...
Eventually we want to put these 2 test plans on a server and have them run one after the other using some maven script, but for now is there any way to accomplish this using Jmeter's command line?
For the command-line non-GUI mode just run your files using shell script like:
jmeter -n -t test1.jmx -l result1.jtl
jmeter -n -t test2.jmx -l result2.jtl
You can also pass the same file via -l command-line option, results of test2.jmx will be appended to the results of test1.jmx.
For Maven execution just copy both .jmx scripts to src/test/jmeter folder of your project - Maven will execute the tests sequentially.
After test execution you will be able to find results files under target/jmeter/results folder, one file per .jmx script. The results can be merged together via i.e. Merge Results tool
More information:
JMeter Maven Plugin
Five Ways To Launch a JMeter Test without Using the JMeter GUI

Quit Jmeter after tests and save aggregate reports

Yesterday due to some reason my Jmeter Machine crashed and I do not have results.
These results run overnight on a laptop, what I am looking for is, I can quit Jmeter ones tests are done and my reports get saved automatically.
Given you run JMeter in command-line non-GUI mode like:
jmeter -n -t /your/script.jmx -l /test/results.jtl
JMeter should store test execution results in the results.jtl file. When the test is finished you will be able to open the file with the Listener of your choice using "Browse" button and analyze the results.
Even in that case you can loose some data in case of JVM crash, by default JMeter doesn't store each single result, it periodically flushes results data. You can add the next line to user.properties file in order to tell JMeter to store each single result immediately (JMeter restart will be required to pick the property up):
jmeter.save.saveservice.autoflush=true
Alternative way is passing the property via -J command-line argument like:
jmeter -Jjmeter.save.saveservice.autoflush=true -n -t /your/script.jmx -l /test/results.jtl
See Listeners > Default Configuration to learn more about JMeter defaults, what properties are available and what can be changed to make results to look accordingly to your requirements
Run the JMeter always in Non-GUI mode.
Following is the command:
jmeter.bat -n -t Sctipt.jmx -l results.jtl
-l : option to save the results.
When the test is completed, automatically results will be saved in results.jtl file. you can give full path also, otherwise, saves the file in current directory i.e., JMeter folder where 'jmeter.bat' file present.
Don't keep any listeners in the script as they utilizes system resources.

I want to schedule task at particular time using JMeter

I want to schedule JMeter so that it will run a test thread automatically after every 1 or 2 hrs.
There are at least 2 options:
JMeter test can be run in command-line non-GUI mode like:
jmeter -n -t /path/to/testplan.jmx -l /path/to/results.jtl
If you put above line into a shell script file should be able to use your operating system scheduling mechanism to run it as you need:
Windows Task Scheduler - for MS Windows Family
launchd - for MacOSX
cron - for Linux/Unix
You can set Loop Count to "Forever" on Thread Group level and put a Constant Timer to sleep desired number of time between test iterations.
You can schedule your test with the help of windows Task Scheduler
1. Create a batch file write below code,do required modification
D:
cd Software\apache-jmeter-2.13\apache-jmeter-2.13\bin
jmeter -n -t D:\test.jmx -l D:\results.jtl
2.open Task Scheduler, create a task, add the batch file path and schedule
your task on the base your requirement
Hope that will help full for you

Resources