微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java – Gatling 2.0 throttle不发送任何请求

我正在尝试使用节流功能运行简单的gatling场景,但没有请求发送到服务器.

我正在使用gatling 2.0.2,Java 1.8.0_25,Maven 3.2.3(全部在OS X上运行)

我的代码看起来像这样:

object RequestHomePage {

  def apply() = {
      exec(http("Home Page Request")
        .get("http://my.page/home")
        .header("Accept", "application/xml,application/xhtml+xml")
  }
}

object HomePage {

  val executeScenario = scenario("Home Page Retrieval")
                                  exec(RequestHomePage())
}

class PerformaceSimulation extends Simulation {

  val maxResponseTime = 5000 // milliseconds

  val simultaneousUsers = atOnceUsers(100)

  setUp(HomePage.executeScenario
          .inject(atOnceUsers(100))
          .throttle(jumpToRps(1), holdFor(10 seconds))
    )
    .protocols(httpProtocol)
    .assertions(
      global.responseTime.max.lessthan(maxResponseTime)1
    )
}

输出如下:

    ================================================================================
    2015-02-20 16:39:41                                           4s elapsed
    ---- Home Page Retrieval -------------------------------------------------------
    [##########################################################################]100%
              waiting: 0      / active: 0      / done:100   
    ---- Requests ------------------------------------------------------------------
    > Global                                                   (OK=0      KO=0     )

    ================================================================================
Simulation finished
Parsing log file(s)...
Parsing log file(s) done
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:483)
    at scala_maven_executions.MainHelper.runMain(MainHelper.java:164)
    at scala_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.java:26)
Caused by: java.lang.UnsupportedOperationException: There were no requests sent during the simulation, reports won't be generated

有没有人知道为什么会限制(…)不发送任何请求?
谢谢

解决方法:

自2.0.2以来,有一些关于限制的错误修复.请升级到2.1.4.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐