0

I am trying to create mvn based meter project based on keyword driven frame, on execution, it work fine, but report is basic, I need a report which has more information like latency, throughput, etc, I tried a lot but no success.

I tried ant plugin but it given me error :

Executing tasks
     [java] java.lang.NoClassDefFoundError: org/apache/jorphan/util/JMeterException
     [java]     at java.lang.Class.getDeclaredConstructors0(Native Method)
     [java]     at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
     [java]     at java.lang.Class.getConstructor0(Class.java:3075)
     [java]     at java.lang.Class.getDeclaredConstructor(Class.java:2178)
     [java]     at org.apache.jmeter.NewDriver.main(NewDriver.java:251)
     [java] Caused by: java.lang.ClassNotFoundException: org.apache.jorphan.util.JMeterException
     [java]     at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
     [java]     ... 5 more
     [java] JMeter home directory was detected as: /Users/admin/Desktop/demo/target/jmeter

Below is my POM File

<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.example</groupId>
<artifactId>jmeter-maven</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>jmeter-maven</name>
<url>http://maven.apache.org</url>
<build>
    <plugins>
        <plugin>
            <groupId>com.lazerycode.jmeter</groupId>
            <artifactId>jmeter-maven-plugin</artifactId>
            <version>1.4.1</version>
            <executions>
                <execution>
                    <id>jmeter-tests</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>jmeter</goal>
                    </goals>
                    <configuration>
                        <jMeterProcessJVMSettings>
                            <xms>1024</xms>
                            <xmx>1024</xmx>
                            <arguments>
                                <argument>-Xprof</argument>
                                <argument>-Xfuture</argument>
                            </arguments>
                        </jMeterProcessJVMSettings>
                        <propertiesUser>
                            <users>${users}</users>
                            <rampUp>${rampUp}
                            </rampUp>
                            <loop>${loopcount}</loop>
                            <url>${url}</url>
                            <suite>${suite}</suite>
                    <jmeter.save.saveservice.bytes>true</jmeter.save.saveservice.bytes>
                    <jmeter.save.saveservice.label>true</jmeter.save.saveservice.label>
                    <jmeter.save.saveservice.latency>true</jmeter.save.saveservice.latency>
                    <jmeter.save.saveservice.response_code>true</jmeter.save.saveservice.response_code>
                    <jmeter.save.saveservice.response_message>true</jmeter.save.saveservice.response_message>
                    <jmeter.save.saveservice.successful>true</jmeter.save.saveservice.successful>
                    <jmeter.save.saveservice.thread_counts>true</jmeter.save.saveservice.thread_counts>
                    <jmeter.save.saveservice.thread_name>true</jmeter.save.saveservice.thread_name>
                    <jmeter.save.saveservice.time>true</jmeter.save.saveservice.time>
                        </propertiesUser>
                        <testFilesIncluded>
                            <jMeterTestFile>testplans/jmeter-maven.jmx</jMeterTestFile>
                        </testFilesIncluded>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
                <execution>
                    <phase>pre-site</phase>
                    <configuration>
                        <tasks>
                            <mkdir dir="${basedir}/target/jmeter/results/dashboard" />
                            <copy file="${basedir}/src/test/resources/reportgenerator.properties" 
                                  tofile="${basedir}/target/jmeter/bin/reportgenerator.properties" />
                            <copy todir="${basedir}/target/jmeter/bin/report-template">
                                <fileset dir="${basedir}/src/test/resources/report-template" />
                            </copy>
                            <java jar="${basedir}/target/jmeter/bin/ApacheJMeter.jar" fork="true">
                                <arg value="-g" />
                                <arg value="${basedir}/target/jmeter/results/*.jtl" />
                                <arg value="-o" />
                                <arg value="${basedir}/target/jmeter/results/dashboard/" />
                            </java>
                        </tasks>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependencies>
    <!-- https://mvnrepository.com/artifact/com.lazerycode.jmeter/jmeter-maven-plugin -->
    <dependency>
        <groupId>com.lazerycode.jmeter</groupId>
        <artifactId>jmeter-maven-plugin</artifactId>
        <version>3.0.0</version>
    </dependency>
</dependencies>

I am following below github link to github

Need an help for same , I tried all but not able to fixed this.

Cod
  • 179
  • 1
  • 12

1 Answers1

2

Please "don't follow below links to github" without understanding what they are doing, you're trying to use JMeter Maven Plugin 1.4.1 which is designed for working with JMeter 2.6 which was good in year 2012 but it doesn't have any HTML Reporting Dashboard capabilities.

The current version of JMeter Maven Plugin is 3.0.0 and you should be following official documentation and according to it generating HTML dashboard is as simple as:

<generateReports>true</generateReports>  

Full pom.xml just in case:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>org.example</groupId>
    <artifactId>jmeter-maven</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <users>1</users>
        <rampup>1</rampup>
        <loopcount>1</loopcount>
        <suite>foo</suite>
        <url>http://example.com</url>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <!-- Generate JMeter configuration -->
                    <execution>
                        <id>configuration</id>
                        <goals>
                            <goal>configure</goal>
                        </goals>
                    </execution>
                    <!-- Run JMeter tests -->
                    <execution>
                        <id>jmeter-tests</id>
                        <goals>
                            <goal>jmeter</goal>
                        </goals>
                    </execution>
                    <!-- Fail build on errors in test -->
                    <execution>
                        <id>jmeter-check-results</id>
                        <goals>
                            <goal>results</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <generateReports>true</generateReports>
                    <testFilesIncluded>
                        <jmeterTestFile>test1.jmx</jmeterTestFile>
                        <jmeterTestFile>test2.jmx</jmeterTestFile>
                    </testFilesIncluded>
                    <propertiesUser>
                        <users>${users}</users>
                        <rampUp>${rampup}</rampUp>
                        <loop>${loopcount}</loop>
                        <url>${url}</url>
                        <suite>${suite}</suite>
                    </propertiesUser>
                </configuration>
            </plugin>
        </plugins>
    </build>


</project>
Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Hi Dimitri, Thanks this works for me. When I want to add drivers(jar and dll files) for MariaDB, and MS SQL database where do I have to add these drivers when I use this Jmeter Maven plugin ? Maybe as Maven dependencys ? And my custom Java Request samplers ? You have any idea ? – Ben Apr 14 '20 at 17:55
  • https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/wiki/Adding-Excluding-libraries-to-from-the-classpath – Ardesco Jun 24 '20 at 15:32