<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.chen</groupId> <artifactId>jemter-project</artifactId> <version>1.0-SNAPSHOT</version> <!--<properties>--> <!--<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>--> <!--<jmeter.result.jtl.dir>${project.build.directory}\jmeter\results</jmeter.result.jtl.dir>--> <!--<jmeter.result.html.dir>${project.build.directory}\jmeter\html</jmeter.result.html.dir>--> <!--<ReportName>TestReport</ReportName>--> <!--</properties>--> <!--<dependencies>--> <!--<dependency>--> <!--<groupId>log4j</groupId>--> <!--<artifactId>log4j</artifactId>--> <!--<version>1.2.17</version>--> <!--</dependency>--> <!--<dependency>--> <!--<groupId>org.uncommons</groupId>--> <!--<artifactId>reportng</artifactId>--> <!--<version>1.1.4</version>--> <!--<scope>test</scope>--> <!--<exclusions>--> <!--<exclusion>--> <!--<groupId>org.testng</groupId>--> <!--<artifactId>testng</artifactId>--> <!--</exclusion>--> <!--</exclusions>--> <!--</dependency>--> <!--<dependency>--> <!--<groupId>junit</groupId>--> <!--<artifactId>junit</artifactId>--> <!--<version>3.8.1</version>--> <!--<scope>test</scope>--> <!--</dependency>--> <!--</dependencies>--> <!--<build>--> <!--<plugins>--> <!--<plugin>--> <!--<groupId>com.lazerycode.jmeter</groupId>--> <!--<artifactId>jmeter-maven-plugin</artifactId>--> <!--<version>2.2.0</version>--> <!--<executions>--> <!--<execution>--> <!--<id>jmeter-tests</id>--> <!--<goals>--> <!--<goal>jmeter</goal>--> <!--</goals>--> <!--</execution>--> <!--</executions>--> <!--</plugin>--> <!--<plugin>--> <!--<groupId>org.codehaus.mojo</groupId>--> <!--<artifactId>xml-maven-plugin</artifactId>--> <!--<version>1.0-beta-3</version>--> <!--<executions>--> <!--<execution>--> <!--<phase>install</phase>--> <!--<goals>--> <!--<goal>transform</goal>--> <!--</goals>--> <!--</execution>--> <!--</executions>--> <!--<configuration>--> <!--<testFilesIncluded>--> <!--<jMeterTestFile>csdn.jmx</jMeterTestFile>--> <!--<jMeterTestFile>baidu.jmx</jMeterTestFile>--> <!--</testFilesIncluded>--> <!--<transformationSets>--> <!--<transformationSet>--> <!--<dir>${jmeter.result.jtl.dir}</dir>--> <!--<stylesheet>src\test\resources\jmeter-results-detail-report_21.xsl</stylesheet>--> <!--<outputDir>${jmeter.result.html.dir}</outputDir>--> <!--<fileMappers>--> <!--<fileMapper--> <!--implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">--> <!--<targetExtension>html</targetExtension>--> <!--</fileMapper>--> <!--</fileMappers>--> <!--</transformationSet>--> <!--<transformationSet>--> <!--<dir>${jmeter.result.jtl.dir}</dir>--> <!--<stylesheet>src\test\resources\jmeter.results.shanhe.me.xsl</stylesheet>--> <!--<outputDir>${jmeter.result.html.dir}</outputDir>--> <!--<fileMappers>--> <!--<fileMapper--> <!--implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">--> <!--<targetExtension>html</targetExtension>--> <!--</fileMapper>--> <!--</fileMappers>--> <!--</transformationSet>--> <!--</transformationSets>--> <!--</configuration>--> <!--<!– using XSLT 2.0 –>--> <!--<dependencies>--> <!--<dependency>--> <!--<groupId>net.sf.saxon</groupId>--> <!--<artifactId>saxon</artifactId>--> <!--<version>8.7</version>--> <!--</dependency>--> <!--</dependencies>--> <!--</plugin>--> <!--</plugins>--> <!--</build>--> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <jmeter.result.jtl.dir>${project.build.directory}\jmeter\results</jmeter.result.jtl.dir> <jmeter.result.html.dir>${project.build.directory}\jmeter\html</jmeter.result.html.dir> </properties> <build> <plugins> <plugin> <!-- 核心插件,用来执行jmx脚本,版本号对应的jmeter版本可在此地址查询 https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/master/CHANGELOG.md--> <groupId>com.lazerycode.jmeter</groupId> <artifactId>jmeter-maven-plugin</artifactId> <version>2.2.0</version> <configuration> <!-- 设置jmeter生成结果文件格式--> <resultsFileFormat>xml</resultsFileFormat> <!-- 设置忽略失败是否停止运行--> <ignoreResultFailures>true</ignoreResultFailures> <!--设置结果是否有时间戳--> <testResultsTimestamp>false</testResultsTimestamp> <testFilesIncluded> <!-- //指定运行的jmeter脚本 --> <jMeterTestFile>baidu.jmx</jMeterTestFile> <jMeterTestFile>csdn.jmx</jMeterTestFile> </testFilesIncluded> <!-- 指定jtl生成目录 --> <resultsDirectory>${jmeter.result.jtl.dir}</resultsDirectory> </configuration> <executions> <execution> <id>jmeter-tests</id> <phase>verify</phase> <!--脚本所在的文件夹 --> <goals> <goal>jmeter</goal> </goals> </execution> </executions> </plugin> <plugin> <!--根据xsl模版把jtl文件转换成html--> <groupId>org.codehaus.mojo</groupId> <artifactId>xml-maven-plugin</artifactId> <version>1.0-beta-3</version> <executions> <execution> <phase>install</phase> <goals> <goal>transform</goal> </goals> </execution> </executions> <configuration> <transformationSets> <transformationSet> <dir>${jmeter.result.jtl.dir}</dir> <stylesheet>src\test\resources\jmeter.results.shanhe.me.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> <!-- using XSLT 2.0 --> <dependencies> <dependency> <groupId>net.sf.saxon</groupId> <artifactId>saxon</artifactId> <version>8.7</version> </dependency> </dependencies> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> </dependencies> </project>