4

Currently we are using Performance Center for the load test,eventually we will move to JMeter.

In Performance center we ran 200 scripts together.

In the Same way ,How to run multiple jmx scripts together in JMeter?

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
rpagadala
  • 796
  • 2
  • 15
  • 31
  • Do you mean you ran the same script 200 times, or run 200 different scripts in parallel? JMeter can do it both ways, please clarify. – CharlieS Nov 18 '14 at 05:01
  • Hi Charlie, 1.200 different scripts 2.Total no.of users : 451 3.Test duration is:2 hrs 15 mins 4.Assign individual no of users for each script I.e Script1: 8 users;script 2: 4 users; script 3:1 user soo on... How do I do this in JMeter? Thanks, Raj – rpagadala Nov 25 '14 at 15:52

3 Answers3

5

Using non-ui mode you can run multiple jmx scripts by providing -t option like,

Jmeter.bat or Jmeter.sh -n -t scritp1.jmx script2.jmx ... 

or create multiple sessions using a wrapper script in shell or batch pgming which will run those scripts in parallel

like,

Jmeter.bat or Jmeter.sh -n -t scritp1.jmx &
Jmeter.bat or Jmeter.sh -n -t scritp2.jmx &
Nachiket Kate
  • 8,473
  • 2
  • 27
  • 45
  • Hi Nachiket, Could you please elaborate little bit.Do I need to run from Command prompt? Could you please provide the steps for me. I have stored the scripts in separate folder in JMeter folder like this C:\JMETER\J_Scripts Thanks,Raj – rpagadala Nov 25 '14 at 20:39
  • 1
    Hi Nachiket, I am able to run single script successfully from the command prompt. But when I tried to run for Multi scripts thrown below error C:\Users\XXXXX>C:\JMETER\apache-jmeter-2.11\bin\jmeter.bat -n -t PERF_SOA_CompanySetup_Indie.jmx PERF_SOA_CompanySetup_NBCU.jmx An error occurred: Unknown arg: PERF_SOA_CompanySetup_NBCU.jmx errorlevel=1 Press any key to continue . . . Thanks,Raj – rpagadala Nov 25 '14 at 21:42
  • To run multiple scripts in parallel you need to create multiple instances of JMeter JVM process i.e.run 2 JMeter instances. For Linux I have already provided the script & and & which will start 2 Jmeter instances in background running your scripts. From error, I think you have windows. In Windows search for running command in background in batch programming and then you can write a batch script run in background and run in background. If still its not clear then we can have chat room discussion. – Nachiket Kate Nov 26 '14 at 05:47
  • 5
    Jmeter.bat or Jmeter.sh -n -t scritp1.jmx script2.jmx ... will not help, it is failing to recognize the second argument passed as part of -t. Failed with illegal Argument exception – manu endla Jul 11 '17 at 08:49
  • With multiple file it is not working. – yuvraj Jun 17 '21 at 16:46
4

You can use JMeter Ant Task or JMeter Maven Plugin to kick off tests execution. Both tools have capabilities to execute tasks in parallel.

If needed you can merge execution result files with MergeResults plugin.

For more options on how JMeter test can be started refer to 5 Ways To Launch a JMeter Test without Using the JMeter GUI guide.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Thanks Dmitri! Even though I have installed Standard Plugin, as you said i couldn't find the Merge Results option. I am using Verizon 2.11 – rpagadala Nov 25 '14 at 20:25
  • Hey Dmitri, Could you please provide step by step hoe to run multi scripts using JMeter Maven Plugin and also Icould not find the Mvn/Ant Plugin in the http://jmeter-plugins.org/ site Thanks,Raj – rpagadala Nov 25 '14 at 20:45
  • its the other way around, look for the jmeter plugin on the maven site – CharlieS Nov 26 '14 at 00:02
  • also, not sure how maven runs tests in parallel, ant can, but maven seems to be sequential. @dmitri-t? – CharlieS Nov 26 '14 at 00:29
  • Maven can fork separate JVM processes so it is possible. http://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html – Dmitri T Nov 26 '14 at 08:25
  • @DmitriT surefire is for junit and testng, how is it configured to run jmeter parallel? – CharlieS Nov 27 '14 at 01:51
4

The easy way is to start all the scripts from the command line at the same time and have each script programmed with number of users, etc. I use Windows, and create a batch file containing multiple lines like:

start /REALTIME java -jar ApacheJMeter.jar -n -t test_script1.jmx -l results1.jtl -j log1.log -Dthreads=40 -Dduration=1800

However, for the scale of your setup, I would recommend you look into a better method of controlling your testing through automation.

I have set up a Jenkins server, which is able to run JMeter scripts using maven, or shell scripts, and then aggregate results, create graphs, etc. It is able to trigger jobs in parallel, sequence, randomly, or triggered by other events.

I would also look at setting up your scripts to use properties for number of threads, loops and duration, so you can control them easily from Jenkins without modifying the scripts. Create a User Defined Variables config element, and copy property values to variables, setting defaults, ie:

THREADS    ${__P("threads", 25)}

This will mean ${THREADS} can be used in the thread group, and will be default value 25. If you assign a value on the command line it will be used instead of default. You can define it on the JVM command line, when you start JMeter like this:

-Dthreads=40

In your script, the value of ${THREADS} will now be 40.

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
CharlieS
  • 1,432
  • 1
  • 9
  • 10