jmeter 3.3 + jmeter-maven-plugin version 2.5
主体:pom.xml + *.jmx
maven结构
总结:
1)*.jmx 脚本文件 由 jmete生成
jmeter-maven-plugin
参考资料:https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/Advanced-Configuration
主体:pow.xml
<!-- jmeter插件 -->
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>2.5.0</version>
<executions>
<execution>
<id>jmeter-tests</id>
<!-- 启动命令 -->
<phase>verify</phase>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
<configuration>
<resultsFileFormat>xml</resultsFileFormat>
<jmeterExtensions>
<!-- jmeter第三方插件 -->
<artifact>kg.apc:jmeter-plugins-json:2.6</artifact>
</jmeterExtensions>
<overrideRootLogLevel>debug</overrideRootLogLevel>
<ignoreResultFailures>true</ignoreResultFailures>
<testResultsTimestamp>false</testResultsTimestamp>
<!-- 限制测试的脚本 -->
<testFilesIncluded>
<jMeterTestFile>chengdu.jmx</jMeterTestFile>
</testFilesIncluded>
<!-- 解决报错 依赖关系树还是什么的 -->
<downloadExtensionDependencies>false</downloadExtensionDependencies>
<excludedArtifacts>
<exclusion>commons-pool2:commons-pool2</exclusion>
<exclusion>commons-math3:commons-math3</exclusion>
</excludedArtifacts>
</configuration>
</plugin>
<!--根据xsl模版把jtl文件转换成html,官网地址: http://www.mojohaus.org/xml-maven-plugin/examples/transform-saxon.html -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>transform</goal>
</goals>
</execution>
</executions>
<configuration>
<transformationSets>
<transformationSet>
<dir>${jmeter.result.jtl.dir}</dir>
<stylesheet>src/test/resources/jmeter-results-report_21.xsl</stylesheet>
<outputDir>${jmeter.result.html.dir}</outputDir>
<!-- 把jtl格式转传承html -->
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
<dependencies>
<!-- using XSLT 2.0 -->
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>saxon</artifactId>
<version>8.7</version>
</dependency>
</dependencies>
</plugin>
成功运行;
jmeter集成jenkins: