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

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

Related

How do I prevent JMeter from exiting upon successful execution of the test?

I am running JMeter version 3.3 in non-GUI mode and I do not want the process to exit upon successful execution of the test.
I have tried running following command:
$ ./bin/jmeter -n -t scenarios/WebTestPlan.jmx -LDEBUG -Jjmeterengine.force.system.exit=false
But it doesn't do the trick. How do I achieve desired behavior?
If basing your approach on time is acceptable and you don't need JMeter report to be generated on Heroku, add a tearDown Thread Group that contains an infinite sleep using Timer.
If you need report, then do a sleep in a shell

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

insert delay in jmeter in capturing results

I have a jmeter script which does a remote ssh and executes a R script now I need the jmeter to delay wherein it starts capturing results in the listeners after say 6 seconds how can I achieve that.
I don't think you'll be able to do it using JMeter Test Elements however you can insert a delay on SSH command level using sleep command like:
./your_R_Script && sleep 6
See How to Run External Commands and Programs Locally and Remotely from JMeter for more tips and tricks on how to kick off remote processes from JMeter

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

DATASTAGE: how to run more instance jobs in parallel using DSJOB

I have a question.
I want to run more instance of same job in parallel from within a script: I have a loop in which I invoke jobs with dsjob and without option "-wait" and "-jobstatus".
I want that jobs completed before script termination, but I don't know how to verify if job instance terminated.
I though to use wait command but it is not appropriate.
Thanks in advance
First,you should assure job compile option "Allow Multiple Instance" choose.
Second:
#!/bin/bash
. /home/dsadm/.bash_profile
INVOCATION=(1 2 3 4 5)
cd $DSHOME/bin
for id in ${INVOCATION[#]}
do
./dsjob -run -mode NORMAL -wait test demo.$id
done
project -- test
job -- demo
$id -- invocation id
the two line in shell scipt:guarantee the environment path can work.
Run the jobs like you say without the -wait, and then loop around running dsjob -jobinfo and parse the output for a job status of 1 or 2. When all jobs return this status, they are all finished.
You might find, though, that you check the status of the job before it actually starts running and you might pick up an old status. You might be able to fix this by first resetting the job instance and waiting for a status of "Not running", prior to running the job.
Invoke the jobs in loop without wait or job-status option
after your loop , check the jobs status by dsjob command
Example - dsjob -jobinfo projectname jobname.invocationid
you can code one more loop for this also and use sleep command under that
write yours further logic as per status of the jobs
but its good to create Job Sequence to invoke this multi-instance job simultaneously with the help of different invoaction-ids
create a sequence job if these are in same process
create different sequences or directly create different scripts to trigger these jobs simultaneously with invocation- ids and schedule in same time.
Best option create a standard generalized script where each thing will be getting created or getting value as per input command line parameters
Example - log files on the basis of jobname + invocation-id
then schedule the same script for different parameters or invocations .

Resources