jmeterpom.xmljmeter-5.0jmeter-maven-plugin

I am getting an error "Error generating the report: java.lang.NullPointerException" while running the JMeter script using JMeter-Maven plugin


I am getting an error "Error generating the report: java.lang.NullPointerException" while running the JMeter script using JMeter-Maven plugin.

Below is the screen shot of the error I am getting: Error Image

Below is my pom.xml file:

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.branch.performance simplifiedAccess 0.0.1-SNAPSHOT

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <!--Access Portal Login page URL -->
    <AccessLoginPageURL>test-login.com</AccessLoginPageURL>
    <!-- base URL -->
    <BaseURL>test.branch.com</BaseURL>
    <!-- Number of users to simulate to execute the performance test plan -->
    <numberOfUsers>3</numberOfUsers>
    <!-- Time in seconds to get all users activated -->
    <rampupTimeInSeconds>1</rampupTimeInSeconds>
    <!-- Number of times the plan executed by every user -->
    <numberOfLoops>1</numberOfLoops>
    <apdexSatisfiedThreshold>2000</apdexSatisfiedThreshold>
    <apdexToleratedThreshold>4000</apdexToleratedThreshold>
    <!-- JMeter Dashboard output file report name -->
    <jmeterReportTitle>Performance Dashboard</jmeterReportTitle>
</properties>


<build>
    <plugins>
        <plugin>
            <groupId>com.lazerycode.jmeter</groupId>
            <artifactId>jmeter-maven-plugin</artifactId>
            <version>3.0.0</version>


            <executions>
                <execution>
                    <id>configuration</id>
                    <goals>
                        <goal>configure</goal>
                    </goals>
                </execution>
                <execution>
                    <id>jmeter-tests</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>jmeter</goal>
                    </goals>
                </execution>
                <execution>
                    <id>jmeter-check-results</id>
                    <goals>
                        <goal>results</goal>
                    </goals>
                </execution>
            </executions>

            <configuration>
                    <junitLibraries>
                        <artifact>mysql:mysql-connector-java:8.0.18</artifact>
                    </junitLibraries>
                <testFilesIncluded>

                    <jMeterTestFile>MyTestFile.jmx</jMeterTestFile>
                </testFilesIncluded>
                <testResultsTimestamp>false</testResultsTimestamp>
                <propertiesUser>
                    <AccessLoginPageURL>${LoginPageURL}</AccessLoginPageURL>
                    <BaseURL>${BaseURL}</BaseURL>
                    <numberOfUsers>${numberOfUsers}</numberOfUsers>
                    <rampupTimeInSeconds>${rampupTimeInSeconds}</rampupTimeInSeconds>
                    <numberOfLoops>${numberOfLoops}</numberOfLoops>
                    <jmeter.reportgenerator.apdex_satisfied_threshold>${apdexSatisfiedThreshold}</jmeter.reportgenerator.apdex_satisfied_threshold>
                    <jmeter.reportgenerator.apdex_tolerated_threshold>${apdexToleratedThreshold}</jmeter.reportgenerator.apdex_tolerated_threshold>
                    <jmeter.reportgenerator.report_title>${jmeterReportTitle}</jmeter.reportgenerator.report_title>
                    <!-- if below is true then doesn't show summary of events in console log -->
                    <summariser.ignore_transaction_controller_sample_result>false</summariser.ignore_transaction_controller_sample_result>
                    <jmeter.save.saveservice.subresults>true</jmeter.save.saveservice.subresults>
                    <!-- Generate JMeter report with only transaction labels and data without sub samplers -->
                    <!--jmeter.reportgenerator.exporter.html.show_controllers_only>true</jmeter.reportgenerator.exporter.html.show_controllers_only-->                      
                </propertiesUser>
                <generateReports>true</generateReports>
            </configuration>
        </plugin>
    </plugins>
</build>
<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>3.0.0-M4</version>
        </plugin>
    </plugins>
</reporting>


Solution

  • Your test didn't execute successfully:

    enter image description here

    therefore results file is empty therefore JMeter fails to generate the HTML Reporting Dashboard.

    Actually a not-properly-handled NPE indicates that a big problem in the code as yoiu shouldn't normally see issues like this in more or less mature software so you can report the issue via JMeter Bugzilla as JMeter shouldn't throw a NPE, it should rather report a human-readable message that the results file is empty suggesting inspecting jmeter.log file for possible reasons.

    So you should see your_test_script_name.jmx.log file under target/jmeter/logs folder., I'm pretty much sure that you will find the root cause of your test script failure there.

    Check out How to Use the JMeter Maven Plugin article for more information on running JMeter tests via Apache Maven