How to pass variables from Jenkins, to maven to JMeter

1,867 views
Skip to first unread message

mike...@gmail.com

unread,
Jun 13, 2014, 9:28:47 AM6/13/14
to maven-jmeter...@googlegroups.com
I have all my tests working in Jmeter and running in Maven and Jenkins. I read this article:
https://blog.codecentric.de/en/2014/01/automating-jmeter-tests-maven-jenkins/

I run mvn chronos-jmeter:jmeter to get it to work.

The problem is the section in the article that talks about parameters to JMeter. I have parameters in JMeter for threadCount and loopCount like he shows in his example but he never actually shows how to wire these in. The XML in his maven pom.xml doesn't match up and he never actually gives the property name in JMeter.

In JMeter I have 2 user defined variables (in a "User Defined Variable" node)

name: threadCount
value: ${__P{threadCount,15}}

name: loopCount
value: ${__P{loopCount,15}}

and inside my JMeter ThreadGroup node I have this:

Number of Threads: ${threadCount}
Loop Count: ${loopCount}

This works in JMeter. I can change the variables and do a -J command line option and it changes. The problem is the maven integration. I have this section in my maven pom.xml:

<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.8.1</version>
<configuration>
<propertiesUser>
<threadCount>${threadCount}</threadCount>
<loopCount>${loopCount}</loopCount>
</propertiesUser>
</configuration>
</plugin>
</plugins>
</build>

I do mvn chronos-jmeter:jmeter -DloopCount=5

and it doesn't appear to change anything.

Please help. Thank you very much.

Ardesco

unread,
Jun 25, 2014, 3:38:23 AM6/25/14
to maven-jmeter...@googlegroups.com, mike...@gmail.com
It sounds like you are getting confused between two different plugins, chronos-jmeter is another plugin and not the one being used in that blog post or on this mailing list.

Ashneet Ladhar

unread,
Aug 5, 2014, 2:49:32 PM8/5/14
to maven-jmeter...@googlegroups.com, mike...@gmail.com
How can see response data of my .jtl file? When I open .jtl file in jmeter-gui view tree listener I am not able to see the response data. Through response data I want to see that I have correctly authenticated the login into website.

 

nmccorm...@gmail.com

unread,
Nov 1, 2017, 12:57:54 PM11/1/17
to Maven JMeter Plugin Users
Try changing the incoming property to look like this:
${__property(loopCount,,15)}

Then when you run mvn verify -DloopCount=5, you should see something like this in the command line output:
[INFO] Starting the test @ Wed Nov 01 12:53:22 EDT 2017 (1509555202901)
[INFO] Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
[INFO] summary = 5 in 00:00:05 = 1.0/s Avg: 132 Min: 15 Max: 537 Err: 0 (0.00%)

Not how it says summary = 5 in.
To see the results, use your JMeter scripts aggregate report piece to open the output JTL and you'll see that there were only 5 runs.

I don't know enough about the chronos-jmeter plugin to comment on that, but the passing in the parameter as I've shown should solve the majority of the issues you have expressed.

Neil.

Reply all
Reply to author
Forward
0 new messages