• 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

    测试报告的路径:

    测试报告的内容:

  • 相关阅读:
    python3初识selenium
    [lucene系列笔记3]用socket把lucene做成一个web服务
    [lucene系列笔记2]在eclipse里初步使用lucene的索引和查询功能
    [lucene系列笔记1]lucene6的安装与配置(Windows系统)
    JAVA SOCKET
    Python3 urlparse
    Windows Socket 编程_ 简单的服务器/客户端程序
    linux软件包管理
    linux用户及权限管理
    docker搭建私有仓库
  • 原文地址:https://www.cnblogs.com/yjlch1016/p/8321830.html
Copyright © 2020-2023  润新知