Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set JMeter properties using Maven plugin

I am using the Maven plugin for JMeter (http://jmeter.lazerycode.com/).

In my JMeter test plan I have defined various properties e.g. hostName, threadCount etc.

If I were to use the standard JMeter program from the command line I would specify the properties like this:

jmeter -n -t mytest.jmx -JhostName=www.example.com -JthreadCount=5

As the Maven JMeter plugin is executed via the following command:

mvn verify

How do I pass the property values? The command:

mvn verify -JhostName=www.example.com -JthreadCount=5

Does not seem to work. I must be missing something obvious

like image 208
Ayub Malik Avatar asked Oct 12 '12 12:10

Ayub Malik


1 Answers

Outside of your <build> block. You can put:

  <properties>
    <my.host>localhost</my.host>
  </properties>

and then update your configuration block to say:

<propertiesUser> 
    <hostName>${my.host}</hostName> 
</propertiesUser> 

Finally, when executing maven, you can override with:

mvn verify "-Dmy.host=www.testsite.com"
like image 193
user2360307 Avatar answered Oct 23 '22 17:10

user2360307