1

I'm using the jmeter-maven-plugin to run my load tests. However, i want to be able to save the aggregate graph as a png.

I saw that there is a JmeterPlugindCMD command line tool that could do that.

But is there any maven plugin that could help with this, since i'm trying to automate this.

Is there any way to get the statistics table from the summary report? That would help too. I do not need the entire csv.

Any leads regarding this would be helpful.

Ardesco
  • 7,281
  • 26
  • 49
Harinya
  • 181
  • 1
  • 4
  • 18

1 Answers1

0

Unfortunately you will not be able to generate Aggregate Graph using JMeterPluginsCMD Command Line Tool, supported chart types are:

  • ThreadsStateOverTime = Active Threads Over Time
  • BytesThroughputOverTime
  • HitsPerSecond
  • LatenciesOverTime
  • ResponseCodesPerSecond
  • ResponseTimesDistribution
  • ResponseTimesOverTime
  • ResponseTimesPercentiles
  • ThroughputVsThreads
  • TimesVsThreads = Response Times VS Threads
  • TransactionsPerSecond

For example, if you want to generate Response Times Over Time chart from JMeter Maven Plugin you can do this in i.e. post-integration-test phase by adding Exec Maven Plugin configured like:

<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>

Full pom.xml file would look something like:

<?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>

See Five Ways To Launch a JMeter Test without Using the JMeter GUI article to learn more about different ways of running JMeter test including (but not limited to) the JMeter Maven Plugin.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133