Jmeter jmx scripts when executed via maven keeps in running in a loop

53 Views Asked by At

When i try to run the jmx (find attached) in jmeter - it runs for one thread but the same jmx when run via maven with jmeter-maven-plugin keeps running in a loop. I have not used any method for now and just relying on static thread count and other numbers hardcoded in jmx.

enter image description here

POMs main component looks like this : enter image description here

Folder structure looks like this: enter image description here

Command used : mvn clean verify

Jmeter version: 5.6.2 maven version: 3.9.1 jmeter-maven-plugin: 3.8.0

When running the same jmx via maven it keeps running in a loop:

enter image description here

On Jmeter GUI it runs normally for one user : enter image description here I am expecting it to work with the same number of threads from maven command line as mentioned in the jmx file.

Also i further plan to use methods to get users/loop count/ ramp up using methods example: ${__P(users,1)} - so expecting to pass users from command line here.

1

There are 1 best solutions below

0
Dmitri T On

I cannot reproduce your issue, check jmeter.log file under target/jmeter/logs directory, it should contain the information regarding which test plan is being executed with how many threads.

enter image description here

Once you sort out "loop" execution problem you can parameterize the number of threads in the following way:

  1. Define a Maven property for the number of users:

    <properties>
        <threads>${users}</threads>
    </properties>
    
  2. Add the above property to JMeter User Properties

    <configuration>
        <propertiesUser>
            <threads>${threads}</threads>
        </propertiesUser>
    </configuration>
    
  3. You should be able to override the number of users from the Maven command line like:

    mvn -Dusers=100 clean verify
    

More information: How to Use the JMeter Maven Plugin