What maven plugin is to be used for JMeter? jmeter-maven-plugin or chronos-jmeter-maven-plugin?

后端 未结 4 1096
萌比男神i
萌比男神i 2021-02-20 14:49

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

4条回答
  •  心在旅途
    2021-02-20 15:17

    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.

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

    1. Create a shell script wrapper that will execute the jmeter test in no gui mode, example (jmeter_exe.sh):

    $JMETER_HOME/bin/jmeter.sh -n -t MY_LOAD_TEST.jmx -l resultFile.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.

    With step one done.

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

    
      exec-maven-plugin
      org.codehaus.mojo
      
        
          Run load Test
          generate-sources
          
            exec
          
          
            ${basedir}/scripts/jmeter_exe.sh
          
        
      
    
    

    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.

提交回复
热议问题