1
votes

I am trying to execute a jmeter test using the maven plugin on a remote server leveraging a pom.xml file that is completely parameterized as below.(I was able to successfully run a maven-jmeter remote test, where the servername, port, protocol and other info are all hard coded in the jmx file.

My pom.xml file is below

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>jmeter-demo</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>jmeter-demo</name>
    <url>http://maven.apache.org</url>
         <description>
    Executes a JMeter test.
  </description>
  <properties>
    <webapp.protocol>http</webapp.protocol>
    <!--<webapp.host>www.mozilla.com</webapp.host>-->
        <webapp.host>fsa-mia-dev2.fsalabs.io</webapp.host>
    <webapp.port>80</webapp.port>
    <test.duration>30</test.duration>
    <test.threads>10</test.threads>
  </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>1.9.0</version>

            <executions>
              <execution>
                <!--
                1)
                  first test run warms up the webserver.
                  Used to fill caches.
                  With a different set of properties since it runs much shorter than a normal test
                  and also the rate of requests/second may be much lower.
                  Maybe also use a different URL set.
                -->
                <id>warmup</id>
                <phase>integration-test</phase>
                <goals>
                  <goal>jmeter</goal>
                </goals>
                <configuration>
                  <propertiesUser>
                    <!--Accesses urls for warmup (compiles JSPs, fills caches, ...)-->

                                        <!--************Setup Config for Threadgroup 23***************-->
                                                            <threadgroup23.name>S23_SFA_Org_CO</threadgroup23.name>
                                        <threadgroup23.Transactionname>T23_SFA_Org_CO</threadgroup23.Transactionname>
                                        <threadgroup23.ThinkTime>5000</threadgroup23.ThinkTime>
                                          <threadgroup23.comment>T23_SFA_Org_CO</threadgroup23.comment>
                    <!--number of threads to use-->
                    <threadgroup23.numberOfThreads>5</threadgroup23.numberOfThreads>
                    <!--delay of the test in seconds-->
                    <threadgroup23.scheduledDelay>0</threadgroup23.scheduledDelay>
                    <!--duration of the test in seconds-->
                    <threadgroup23.scheduledDuration>60</threadgroup23.scheduledDuration>
                    <!--how long till all threads are up and running in seconds-->
                    <threadgroup23.rampUp>1</threadgroup23.rampUp>
                                        <threadgroup23.dataFile>/home/ubuntu/mproj/data/S23_SFA_Org_CO.dat</threadgroup23.dataFile>

                  </propertiesUser>
                </configuration>
              </execution>
              </executions>


  <configuration>
              <testFilesIncluded>
                <testFilesIncluded>01_SA_CU_GetCPS.jmx</testFilesIncluded>
              </testFilesIncluded>

              <!-- protocol, server and port of tested webapp -->
              <propertiesUser>
                <protocol>${webapp.protocol}</protocol>
                <server>${webapp.host}</server>
                <port>${webapp.port}</port>
              </propertiesUser>

<resultsFileFormat>csv</resultsFileFormat>
<testResultsTimestamp>false</testResultsTimestamp>
<ignoreResultFailures>true</ignoreResultFailures>
<remoteConfig>
<startServersBeforeTests>true</startServersBeforeTests>
<serverList>10.36.14.170</serverList>
</remoteConfig>
<suppressJMeterOutput>false</suppressJMeterOutput>
<propertiesSystem>

</propertiesSystem>
<propertiesJMeter><log_level.jmeter>DEBUG</log_level.jmeter></propertiesJMeter>
</configuration>
            </plugin>
        </plugins>
    </build>
</project>

The issue is.. jmeter-server detects a request to execute and almost immediately stops.

Here is the info from log file post run

[debug] JMeter is called with the following command line arguments: -n -t /home/ubuntu/mProj/src/test/jmeter/01_SA_CU_GetCPS.jmx -l /home/ubuntu/mProj/target/jmeter/results/01_SA_CU_GetCPS.csv -d /home/ubuntu/mProj/target/jmeter -j /home/ubuntu/mProj/target/jmeter/logs/01_SA_CU_GetCPS.jmx.log -r -R 10.36.14.170
[info] Executing test: 01_SA_CU_GetCPS.jmx
[info] Created the tree successfully using /home/ubuntu/mProj/src/test/jmeter/01_SA_CU_GetCPS.jmx
[info] Configuring remote engine for 10.36.14.170
[info] Using remote object: UnicastRef [liveRef: [endpoint:[10.36.14.170:37913](remote),objID:[-10468c89:14fba100421:-7fff, -1854422229136130507]]]
[info] Starting remote engines
[info] Starting the test @ Fri Sep 11 01:42:27 UTC 2015 (1441935747716)
[info] Remote engines have been started
[info] Waiting for possible shutdown message on port 4445
[info] Tidying up remote @ Fri Sep 11 01:42:29 UTC 2015 (1441935749973)
[info] Completed Test: 01_SA_CU_GetCPS.jmx
[INFO]
[INFO] Test Results:
[INFO]
[INFO] Tests Run: 1, Failures: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.280s
[INFO] Finished at: Fri Sep 11 01:42:35 UTC 2015
[INFO] Final Memory: 11M/57M
[INFO] ------------------------------------------------------------------------

(The pom-file works well without the remoteConfig - in localhost) (There's no networking issues any where and the remote server is able to access the host and works when servername, port, protocol is hardcoded in jmx files) Is this a known limitation of the maven-jmeter plugin?

1
Are the remote servers defined in your jmeter.properties file? (See github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/… for more information on remote running)Ardesco
Yes (jmeter.properties contains the remote servers). I was able to run the same exact test successfully on the remote server with the servername, protocol and port hard coded inside the jmx file. Any chance that this might actually be a limitation of the jmeter-maven plugin. Based on the log post above, I dont see jmeter-maven plugin sending in these parameters to the remote server. Thanks ArdescoP Misra
It's using the remote parameters, from your log the command line arguments include "-r -R 10.36.14.170"Ardesco
It;s quite possible it is a limitation of the plugin that's not known about. The plugin just configures JMeter and then runs JMeter so it could be that something has been missed.Ardesco
Thanks Ardesco. One way I have worked around this is to move out the configuration( servername, protocol, port, threadgroup23.xxx) into another config.xml file which is in a common location shared by all jmeter slaves.P Misra

1 Answers

1
votes

First use a recent version of jmeter-maven-plugin, 2.8.3 as of 15th january 2019.

To pass parameters, enter in pom.xml as child of configuration:

    <propertiesJMeter>
         <BUILD_TAG>${project.version}</BUILD_TAG>
         <threads>7</threads>
         <duration>30</duration>
     </propertiesJMeter>

And in jmeter, to use threads for example, you would use __P function:

${__P(threads,5)

This blog explains the whole process.