zoukankan      html  css  js  c++  java
  • jmeter-maven-plugin

    Maven编译JMeter,

    使用的是jmeter-maven-plugin插件:

    <?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>shanghai</groupId>
    <artifactId>jmeter_blog</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>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.45</version>
    </dependency>
    </dependencies>

    <build>
    <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>3.0.2</version>
    <executions>
    <execution>
    <phase>package</phase>
    <goals>
    <goal>copy-dependencies</goal>
    </goals>
    </execution>
    </executions>
    <configuration>
    <artifactId>mysql-connector-java</artifactId>
    <outputDirectory>${project.build.directory}/jmeter/lib</outputDirectory>
    </configuration>
    </plugin>
    <plugin>
    <groupId>com.lazerycode.jmeter</groupId>
    <artifactId>jmeter-maven-plugin</artifactId>
    <version>2.4.1</version>
    <configuration>
    <resultsFileFormat>xml</resultsFileFormat>
    <ignoreResultFailures>true</ignoreResultFailures>
    <testResultsTimestamp>false</testResultsTimestamp>
    </configuration>
    <executions>
    <execution>
    <id>jmeter-tests</id>
    <goals>
    <goal>jmeter</goal>
    </goals>
    </execution>
    </executions>
    </plugin>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>3.0.2</version>
    <executions>
    <execution>
    <id>copy-resources</id>
    <phase>compile</phase>
    <goals>
    <goal>copy-resources</goal>
    </goals>
    <configuration>
    <outputDirectory>${project.build.directory}/jmeter/html</outputDirectory>
    <resources>
    <resource>
    <directory>${basedir}/src/main/resources</directory>
    <filtering>true</filtering>
    </resource>
    </resources>
    </configuration>
    </execution>
    </executions>
    </plugin>
    <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>xml-maven-plugin</artifactId>
    <version>1.0.1</version>
    <executions>
    <execution>
    <phase>verify</phase>
    <goals>
    <goal>transform</goal>
    </goals>
    </execution>
    </executions>
    <configuration>
    <transformationSets>
    <transformationSet>
    <dir>${jmeter.result.jtl.dir}</dir>
    <stylesheet>src/main/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>
    </transformationSets>
    </configuration>
    <dependencies>
    <dependency>
    <groupId>net.sf.saxon</groupId>
    <artifactId>saxon</artifactId>
    <version>8.7</version>
    </dependency>
    </dependencies>
    </plugin>
    </plugins>
    </build>

    </project>

    整个工程的目录结构:

    
    

    执行命令mvn verify

    测试报告的路径:

    测试报告的内容:

  • 相关阅读:
    python 集合
    jQuery选择器
    hdu 5747 Aaronson
    hdu 2049 不容易系列之(4)——考新郎
    hdu 2048 神、上帝以及老天爷
    hdu 2045 不容易系列之(3)—— LELE的RPG难题
    hdu 2047 阿牛的EOF牛肉串
    hdu 2046 骨牌铺方格
    hdu 2050 折线分割平面
    hdu 2044 一只小蜜蜂
  • 原文地址:https://www.cnblogs.com/yjlch1016/p/8321830.html
Copyright © 2011-2022 走看看