JMeter使用什么Maven插件? jmeter-maven-plugin或chronos-jmeter-maven-plugin? [英] What maven plugin is to be used for JMeter? jmeter-maven-plugin or chronos-jmeter-maven-plugin?

查看:235
本文介绍了JMeter使用什么Maven插件? jmeter-maven-plugin或chronos-jmeter-maven-plugin?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要设置由CI系统自动触发的性能测试.为此,由于某些脚本和经验我已经想使用JMeter了,我想将其与Maven结合起来.

I need to setup performance tests which are run automatically triggered by a CI system. For that I want to use JMeter due to some scripts and experience already exist and I want to combine it with Maven.

在研究合理的插件过程中,我发现存在两个插件:

During my research for a reasonable plugin I found that two plugins are existing:

  1. jmeter-maven-plugin: http://wiki.apache.org/jmeter/JMeterMavenPlugin
  2. chronos-jmeter-maven-plugin: http://mojo.codehaus.org/chronos/chronos-jmeter -maven-plugin/usage.html
  1. jmeter-maven-plugin: http://wiki.apache.org/jmeter/JMeterMavenPlugin
  2. chronos-jmeter-maven-plugin: http://mojo.codehaus.org/chronos/chronos-jmeter-maven-plugin/usage.html

哪个更好用?两者似乎都正在维护和开发中.有什么经验吗?甚至配置都差不多.

Which one is better to be used? Both seem to be currently maintained and under development. Is there any experience on this? Even the configuration is similar.

我很乐意得到一些提示,以帮助我确定自己的位置,而不必花几天时间使用这两个插件.

I would be happy to get some hints to help me descide without playing around with both plugins for some days.

推荐答案

我尚未将.jmx文件用于maven,尤其是您提到的那些插件.

I haven't yet used the .jmx files with maven and specifically those plugins you mention.

但是我可以想出一种方法,如果我需要的话.

But I can think of a way how to do it if I needed that.

因此考虑到这一点,您可以在无gui模式下执行jmeter测试.

So consider this, you can execute jmeter test in no gui mode.

  1. 创建一个shell脚本包装器,该包装器将在无GUI模式下执行jmeter测试,例如(jmeter_exe.sh):

$JMETER_HOME/bin/jmeter.sh -n -t MY_LOAD_TEST.jmx -l resultFile.jtl

因此这将执行给定脚本并将结果存储在.jtl文件中,您可以使用它来显示测试结果,也许

So this will execute the given script and store results in the .jtl file, you can use that to display your test results maybe this post will be useful to you, it's off topic for now.

完成第一步.

2.然后可以在项目根目录中创建目录scripts.比您可以将其放在pom.xml中:

2.You could then create directory scripts in your project root. Than you can put this in your pom.xml :

<plugin>
  <artifactId>exec-maven-plugin</artifactId>
  <groupId>org.codehaus.mojo</groupId>
  <executions>
    <execution>
      <id>Run load Test</id>
      <phase>generate-sources</phase>
      <goals>
        <goal>exec</goal>
      </goals>
      <configuration>
        <executable>${basedir}/scripts/jmeter_exe.sh</executable>
      </configuration>
    </execution>
  </executions>
</plugin>

瞧,您的测试在generate-sources阶段执行.使用您提到的插件可能会更容易,但是我不知道这些,这就是我想到的.

And voila your test is executed during generate-sources phase. This might have been easier with the plugins you mentioned but I have no knowledge of those, this is what just came to my mind.

这篇关于JMeter使用什么Maven插件? jmeter-maven-plugin或chronos-jmeter-maven-plugin?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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