JMeter运行测试失败

ndasle7k  于 2023-05-17  发布在  其他
关注(0)|答案(2)|浏览(365)

我正在IntelliJ上的一个Java程序上运行一些JMeter的性能测试。一些测试运行良好,但有时我会得到这个错误:

An error occurred: null
errorlevel=1

这是我在日志文件里看到的

2022-03-11 16:55:35,944 ERROR o.a.j.JMeter: An error occurred: 
java.lang.NullPointerException: null
    at org.apache.jmeter.report.dashboard.JsonExporter.createStatistic(JsonExporter.java:121) ~[ApacheJMeter_core.jar:5.4.3]
    at org.apache.jmeter.report.dashboard.JsonExporter.export(JsonExporter.java:72) ~[ApacheJMeter_core.jar:5.4.3]
    at org.apache.jmeter.report.dashboard.ReportGenerator.exportData(ReportGenerator.java:379) ~[ApacheJMeter_core.jar:5.4.3]
    at org.apache.jmeter.report.dashboard.ReportGenerator.generate(ReportGenerator.java:257) ~[ApacheJMeter_core.jar:5.4.3]
    at org.apache.jmeter.JMeter.start(JMeter.java:558) [ApacheJMeter_core.jar:5.4.3]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_291]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_291]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_291]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_291]
    at org.apache.jmeter.NewDriver.main(NewDriver.java:254) [ApacheJMeter.jar:5.4.3]

这是我在调试报告生成时得到的结果

###### [INFO] Will generate HTML report in C:\Users\Exiuser\Documents\qa_can_webservices\jmeter-PerfTest\target\jmeter\reports\Template_PortalPOSTToken
###### [INFO] Executing test: Template_PortalPOSTToken.jmx
###### [INFO] Arguments for forked JMeter JVM: [java, -Xms512M, -Xmx512M, -Djava.awt.headless=true, -jar, ApacheJMeter-5.4.1.jar, -d, C:\Users\Exiuser\Documents\qa_can_webservices\jmeter-PerfTest\target\a07895b0-cee6-4ccb-944c-589f09d421bc\jmeter, -e, -j, C:\Users\Exiuser\Documents\qa_can_webservices\jmeter-PerfTest\target\jmeter\logs\Template_PortalPOSTToken.jmx.log, -l, C:\Users\Exiuser\Documents\qa_can_webservices\Clientes\src\test\resources\CSVDatasTets\Clientes\ClaimChannelAPI\POST_Claim\LoadTest-1Users\20220314-Template_PortalPOSTToken.csv, -n, -o, C:\Users\Exiuser\Documents\qa_can_webservices\jmeter-PerfTest\target\jmeter\reports\Template_PortalPOSTToken, -t, C:\Users\Exiuser\Documents\qa_can_webservices\jmeter-PerfTest\target\jmeter\testFiles\Template_PortalPOSTToken.jmx, -Dsun.net.http.allowRestrictedHeaders, true]
###### [INFO]  
###### [INFO] SLF4J: Class path contains multiple SLF4J bindings.
###### [INFO] SLF4J: Found binding in [jar:file:/C:/Users/Exiuser/Documents/qa_can_webservices/jmeter-PerfTest/target/a07895b0-cee6-4ccb-944c-589f09d421bc/jmeter/lib/log4j-slf4j-impl-2.13.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
###### [INFO] SLF4J: Found binding in [jar:file:/C:/Users/Exiuser/Documents/qa_can_webservices/jmeter-PerfTest/target/a07895b0-cee6-4ccb-944c-589f09d421bc/jmeter/lib/slf4j-nop-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
###### [INFO] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
###### [INFO] SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
###### [INFO] Creating summariser <summary>
###### [INFO] Created the tree successfully using C:\Users\Exiuser\Documents\qa_can_webservices\jmeter-PerfTest\target\jmeter\testFiles\Template_PortalPOSTToken.jmx
###### [INFO] Starting standalone test @ Mon Mar 14 09:08:12 ART 2022 (1647259692040)
###### [INFO] Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
###### [INFO] summary =      0 in 00:00:00 = **/s Avg:     0 Min: 9223372036854775807 Max: -9223372036854775808 Err:     0 (0,00%)
###### [INFO] Tidying up ...    @ Mon Mar 14 09:08:13 ART 2022 (1647259693523)
###### [INFO] Error generating the report: java.lang.NullPointerException
###### [INFO] ... end of run
ymzxtsji

ymzxtsji1#

这并不意味着JMeter“运行测试失败”,而是意味着JMeter无法生成HTML Reporting Dashboard
1.检查您的.jtl results file,它可能不完整或损坏

  1. Enable JMeter debug logging,方法是将下一行添加到 log4j2.xml 文件(位于JMeter安装的“bin”文件夹中)
<Logger name="org.apache.jmeter.report" level="debug" />

并在jmeter.log文件中查找以下条目:

Creating statistics for result data:

检查该行中的对象,它会给予你一个线索,关于什么可能出错

kzmpq1sx

kzmpq1sx2#

我也有同样的问题。在我的例子中,我正在阅读一个csv文件并从该文件生成html报告。csv为空,原因是服务器没有为测试分配内存。

相关问题