我使用 gatling 插件设置了性能测试。如果我在负载配置文件中使用 constantUsersPerSec,则模拟有效。如果我将其更改为 atOnceUsers 则模拟不会运行。不产生负载
我已经尝试过其他注入类型,例如 rampUsers,这也有效。似乎 atOnceUsers 是唯一失败的场景
setUp(
login.inject(
constantUsersPerSec(1) during (10 seconds))
.protocols(protocol)
)
此设置有效并且测试运行。如果我将设置更改为
setUp(
login.inject(
atOnceUsers(1))
.protocols(protocol)
)
然后负载不运行。由于未生成负载,因此未生成报告。
这是运行输出的日志
00:14:38.170 [GatlingSystem-akka.actor.default-dispatcher-3] INFO i.g.c.stats.writer.ConsoleDataWriter - Initializing
00:14:38.179 [GatlingSystem-akka.actor.default-dispatcher-2] INFO i.g.c.stats.writer.LogFileDataWriter - Initializing
00:14:38.194 [GatlingSystem-akka.actor.default-dispatcher-3] INFO i.g.c.stats.writer.ConsoleDataWriter - Initialized
00:14:38.226 [GatlingSystem-akka.actor.default-dispatcher-2] INFO i.g.c.stats.writer.LogFileDataWriter - Initialized
Simulation performance.Load started...
00:14:38.664 [GatlingSystem-akka.actor.default-dispatcher-4] INFO i.g.core.controller.inject.Injector - StoppedInjecting
00:14:39.674 [GatlingSystem-akka.actor.default-dispatcher-2] INFO com.intuit.karate - karate.env system property was: null
00:14:39.735 [GatlingSystem-akka.actor.default-dispatcher-3] INFO i.g.core.controller.inject.Injector - All users of scenario login are stopped
00:14:39.738 [GatlingSystem-akka.actor.default-dispatcher-3] INFO i.g.core.controller.inject.Injector - Stopping
00:14:39.738 [GatlingSystem-akka.actor.default-dispatcher-4] INFO i.gatling.core.controller.Controller - Injector has stopped, initiating graceful stop
================================================================================
2019-04-04 00:14:39 1s elapsed
---- Requests ------------------------------------------------------------------
> Global (OK=0 KO=0 )
---- login ---------------------------------------------------------------------
[##########################################################################]100%
waiting: 0 / active: 0 / done: 1
================================================================================
00:14:39.824 [GatlingSystem-akka.actor.default-dispatcher-3] INFO i.gatling.core.controller.Controller - StatsEngineStopped
Simulation performance.Load completed in 1 seconds
Parsing log file(s)...
00:14:40.012 [main] INFO i.gatling.charts.stats.LogFileReader - Collected ArrayBuffer(C:\Users\Paul.McCormack\source\repos\humm\target\gatling\load-20190403131438042\simulation.log) from load-20190403131438042
00:14:40.036 [main] INFO i.gatling.charts.stats.LogFileReader - First pass
00:14:40.061 [main] INFO i.gatling.charts.stats.LogFileReader - First pass done: read 3 lines
00:14:40.111 [main] INFO i.gatling.charts.stats.LogFileReader - Second pass
00:14:40.147 [main] INFO i.gatling.charts.stats.LogFileReader - Second pass: read 3 lines
Parsing log file(s) done
Generating reports...
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)
at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
Caused by: java.lang.UnsupportedOperationException: There were no requests sent during the simulation, reports won't be generated
at io.gatling.charts.report.ReportsGenerator.generateFor(ReportsGenerator.scala:49)
at io.gatling.app.RunResultProcessor.generateReports(RunResultProcessor.scala:76)
at io.gatling.app.RunResultProcessor.processRunResult(RunResultProcessor.scala:55)
at io.gatling.app.Gatling$.start(Gatling.scala:82)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:47)
at io.gatling.app.Gatling$.main(Gatling.scala:39)
at io.gatling.app.Gatling.main(Gatling.scala)
... 6 more