使用Maven插件设置JMeter属性 [英] Set JMeter properties using Maven plugin

查看:202
本文介绍了使用Maven插件设置JMeter属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JMeter的Maven插件(http://jmeter.lazerycode.com/).

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

在我的JMeter测试计划中,我定义了各种属性,例如hostName,threadCount等.

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

如果要从命令行使用标准的JMeter程序,则应指定以下属性:

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

由于Maven JMeter插件是通过以下命令执行的:

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

推荐答案

<build>块之外.您可以输入:

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> 

最后,在执行Maven时,您可以使用:

Finally, when executing maven, you can override with:

mvn verify "-Dmy.host=www.testsite.com"

这篇关于使用Maven插件设置JMeter属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆