Richard Olsson
Richard Olsson

Reputation: 25

Cannot pass parameters to slaves with distributed JMeter setup with Maven and linux

Using JMeter 2.13, Maven and Linux in all servers. Not running any tests from gui or command line, Maven is used!

Have a test plan with a lot of parameters that are set and passed from Maven execution in Jenkins to the JMeter test plan. Using "-J" in Maven to set the input parameters. Works fine in single JMeter environment.

If I start JMeter in slaves manually first, then start the Jenkins job the test plan in the specified remote servers are started properly. But I have observed that no parameters are transferred to the remote servers. So, I can't control the test plan execution. The temporary workaround is to hardcode some parameters in the test plan. But this is not acceptable solution!

I've looked around a lot. Have found these pages, JMeter distributed testing and command line parameters and this

But I'm running from Maven, not command line, so "-G" doesn't work!

Haven't done any RMI setup, but I don't think that's the problem. Probably more related to how parameters should be transferred to remote servers.

With this setting in pom.xml,

<propertiesJMeter>
    <remote_hosts>10.71.98.54,10.71.98.82,10.71.98.81</remote_hosts>
</propertiesJMeter>

I did manage to get the basic slave connection to work; I see the printout of remote server IP addresses in the output/log and test plan is started and runs fine and logs seems to be okay too. But, problem is that parameters aren't transferred to remote servers!!

Some additional pom configuration:

<configuration>
    <remoteConfig>
        <startServersBeforeTests>true</startServersBeforeTests>
        <stopServersAfterTests>true</stopServersAfterTests>
    </remoteConfig>
    <propertiesUser>
        <THROUGHPUT>${throughput}</THROUGHPUT>
        <NUMBER_OF_LOOPS>${number_of_loops}</NUMBER_OF_LOOPS>
        <DURATION>${duration}</DURATION>
        <NUMBER_OF_CLIENTS>${number_of_clients}</NUMBER_OF_CLIENTS>                
    </propertiesUser>

...

Please, can someone help?

Upvotes: 1

Views: 916

Answers (2)

Dmitri T
Dmitri T

Reputation: 168002

According to the documentation:

Adding Additional Properties To propertiesGlobal


Global properties are properties that are sent to the remote machines. To set those properties you will need to specify each property in your pom.xml in the config element propertiesGlobal (The example below shows a property called threads and a property called testIterations being set).

<project>
    [...]
        <build>
            <plugins>
                <plugin>
                    <groupId>com.lazerycode.jmeter</groupId>
                    <artifactId>jmeter-maven-plugin</artifactId>
                    <version>2.0.3</version>
                    <executions>
                        <execution>
                            <id>jmeter-tests</id>
                            <goals>
                                <goal>jmeter</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <propertiesGlobal>
                            <threads>10</threads>
                            <testIterations>5</testIterations>
                        </propertiesGlobal>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    [...]
</project>

So it looks like you need to move these properties to <propertiesGlobal> from the <propertiesUser>

References:

Upvotes: 1

Richard Olsson
Richard Olsson

Reputation: 25

Thanks a lot. Your first documentation link pointed to wrong page I think. Anyway, I guess you refer to, https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/Modifying-Properties#6

Quite strange that it's so hard to find from the "JMeter dist" guides you can find.

Many thanks. :-) The parameters works fine now.

But the remoteConfig parameters isn't working. Jmeter remote connection throwing "Connection refused to host" https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/Remote-Server-Configuration

But can someone confirm that the conclusion in the first link above is correct?

When I read the information in the second link I did understand it as JMeter doesn't have to be started. But it's so that "jmeter-server" has to be started, otherwize it won't be working, correct? Guess it make sense now.

Upvotes: 0

Related Questions