Set JMeter properties using Maven plugin

試著忘記壹切 提交于 2019-12-07 10:37:51

问题


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


回答1:


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"



回答2:


  <properties>
<my.host>hostname</my.host>

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

Finally, when executing maven, you can override with:

mvn verify "-Dmy.host=www.testsite.com" should it not be like this?



来源:https://stackoverflow.com/questions/12859085/set-jmeter-properties-using-maven-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!