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?

查看:19
本文介绍了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-插件: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.

推荐答案

我还没有在 maven 中使用 .jmx 文件,特别是你提到的那些插件.

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>

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

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