Jmeter 不从命令行(CLI 模式)执行脚本,但在 GUI 模式下工作正常

Jmeter not executing script from command line (CLI mode) but works fine with GUI mode

我在 Jmeter 中编写了一个脚本,可以从 GUI 模式执行,但从 CLI 模式(非 GUI)执行时会失败

这是 CLI 模式的结果:

D:\apache-jmeter-5.4.3\apache-jmeter-5.4.3\bin>jmeter -n -t D:\apache-jmeter-5.4.3\apache-jmeter-5.4.3\bin\homepage.jmx Creating summariser Created the tree successfully using D:\apache-jmeter-5.4.3\apache-jmeter-5.4.3\bin\homepage.jmx Starting standalone test @ Fri Mar 18 09:41:02 EET 2022 (1647589262323) Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445 summary + 1 in 00:00:00 = 25.0/s Avg: 0 Min: 0 Max: 0 Err: 1 (100.00%) Active: 1 Started: 1 Finished: 0 summary + 19 in 00:00:05 = 4.0/s Avg: 0 Min: 0 Max:
0 Err: 19 (100.00%) Active: 0 Started: 20 Finished: 20 summary =
20 in 00:00:05 = 4.2/s Avg: 0 Min: 0 Max: 0 Err: 20 (100.00%) Tidying up ... @ Fri Mar 18 09:41:07 EET 2022 (1647589267321) ... end of run

为什么会发生这种情况,我该如何解决? 谢谢

你只是 运行 你的测试,没有存储结果,从输出来看,你的 20 个请求似乎都失败了。

我会推荐 re-running your test providing the path to the .jtl results file 作为参数,例如:

jmeter -n -t D:\apache-jmeter-5.4.3\apache-jmeter-5.4.3\bin\homepage.jmx -l result.jtl

然后使用 Excel 或等价物检查 result.jtl 文件或从中生成 HTML Reporting Dashboard,您至少会看到响应代码和消息。