运行性能测试时,注入配置文件出现问题

时间:2019-04-03 13:27:29

标签: karate gatling-plugin

我使用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

1 个答案:

答案 0 :(得分:0)

我刚刚尝试在karate-gatling-demo中使用atOnceUsers(10),并且有效。

也许加特灵要求数字大于1?

如果仍然遇到问题,请按照以下过程进行复制:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue