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

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

问题描述

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

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

在我的 JMeter 测试计划中,我定义了各种属性,例如主机名、线程数等

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

推荐答案

块之外.你可以把:

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天全站免登陆