Jmeter+Maven自動化測試,並生成Html報告


利用Jmeter編寫測試用例

導出Jmeter測試文件 *.jmx

並放入/src/test/jmeter目錄中

編寫Maven pom.xml文件

 <?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.ubikloadpack.jmeter</groupId>
<artifactId>maven-generate-reports</artifactId>
<version>1.0.0</version>
<description>Check that report generation works</description>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<build>
    <plugins>
        <plugin>
    <groupId>com.lazerycode.jmeter</groupId>
    <artifactId>jmeter-maven-plugin</artifactId>
    <version>2.2.0</version>
            <configuration>
                <suppressJMeterOutput>false</suppressJMeterOutput>
                <testFilesIncluded>
                    <testFilesIncluded>**/*.jmx</testFilesIncluded>
                </testFilesIncluded>
                <generateReports>true</generateReports>
            </configuration>
            <executions>
                <execution>
                    <id>configure</id>
                    <goals>
                        <goal>configure</goal>
                    </goals>
                </execution>
                <execution>
                    <id>performance test</id>
                    <goals>
                        <goal>jmeter</goal>
                    </goals>
                </execution>
                <execution>
                    <id>verify</id>
                    <goals>
                        <goal>results</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

運行mvn verify

在target目錄就會產生

其中,
reports為html報告
results為csv報告


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM