簡體   English   中英

如何在Maven目標文件夾的文件夾中將jmeter聚合圖保存為png

[英]how to save jmeter aggregate graph as a png in a folder in maven target folder

我正在使用jmeter-maven-plugin運行我的負載測試。 但是,我希望能夠將聚合圖另存為png。

我看到有一個JmeterPlugindCMD命令行工具可以做到這一點。

但是是否有任何Maven插件可以對此提供幫助,因為我正在嘗試使它自動化。

有什么方法可以從摘要報告中獲取統計信息表? 那也有幫助。 我不需要整個csv。

關於此的任何線索都將有所幫助。

不幸的是,您將無法使用JMeterPluginsCMD命令行工具生成匯總圖,支持的圖表類型包括:

  • ThreadsStateOverTime =一段時間內活動線程
  • BytesThroughputOverTime
  • 每秒點擊數
  • 延遲超時
  • 每秒鍾ResponseCodes
  • ResponseTimesDistribution
  • ResponseTimesOverTime
  • 響應時間百分位數
  • 吞吐量線程
  • TimesVsThreads =響應時間VS線程
  • 每秒交易數

例如,如果您想從JMeter Maven插件生成“隨時間變化的響應時間”圖表,則可以在post-integration-test階段通過添加配置如下的Exec Maven插件來做到這一點:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
    <execution>
        <id>generate-aggregate-report</id>
        <phase>post-integration-test</phase>
        <goals>
            <goal>exec</goal>
        </goals>
        <configuration>
            <basedir>${basedir}/target/jmeter/lib</basedir>
            <executable>java</executable>
            <commandlineArgs>-jar cmdrunner-2.2.1.jar --tool Reporter --generate-png ${basedir}/target/aggregate.png --input-jtl ${basedir}/target/jmeter/results/${timestamp}-test.csv --plugin-type ResponseTimesOverTime</commandlineArgs>
        </configuration>
    </execution>
</executions>
</plugin>

完整的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>jmeter-maven</groupId>
    <artifactId>com.example.jmeter-maven</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <timestamp>${maven.build.timestamp}</timestamp>
        <maven.build.timestamp.format>yyyyMMdd</maven.build.timestamp.format>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>2.7.0</version>
                <configuration>
                    <jmeterExtensions>
                        <artifact>kg.apc:jmeter-plugins-cmd:2.1</artifact>
                        <artifact>kg.apc:cmdrunner:2.2.1</artifact>
                        <artifact>kg.apc:jmeter-plugins-cmn-jmeter:0.5</artifact>
                        <artifact>kg.apc:jmeter-plugins-synthesis:2.1</artifact>
                        <artifact>kg.apc:jmeter-plugins-graphs-basic:2.0</artifact>
                    </jmeterExtensions>
                    <downloadExtensionDependencies>false</downloadExtensionDependencies>
                </configuration>
                <executions>
                    <execution>
                        <id>jmeter-tests</id>
                        <goals>
                            <goal>jmeter</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jmeter-check-results</id>
                        <goals>
                            <goal>results</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                    <execution>
                        <id>copy-cmdrunner-to-lib-folder</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <basedir>${basedir}/target/jmeter/lib/ext</basedir>
                            <executable>cp</executable>
                            <commandlineArgs>cmdrunner-2.2.1.jar ..</commandlineArgs>
                        </configuration>
                    </execution>
                    <execution>
                        <id>generate-aggregate-report</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <basedir>${basedir}/target/jmeter/lib</basedir>
                            <executable>java</executable>
                            <commandlineArgs>-jar cmdrunner-2.2.1.jar --tool Reporter --generate-png ${basedir}/target/aggregate.png --input-jtl ${basedir}/target/jmeter/results/${timestamp}-test.csv --plugin-type ResponseTimesOverTime</commandlineArgs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

請參閱不使用JMeter GUI來啟動JMeter測試的五種方法,以了解有關運行JMeter測試的不同方式的更多信息,包括(但不限於)JMeter Maven插件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM