【问题标题】:How to run gatling with scala file name without simulation name?如何在没有模拟名称的情况下使用 scala 文件名运行加特林?
【发布时间】:2019-03-06 11:49:34
【问题描述】:

我使用./gatling.sh -s className 命令运行加特林。 但是类名可以与模拟文件名不同。 例如下面的模拟名称是Test,但scala文件名可以不同。文件名是TestSimulation.scala. 如何使用文件名运行模拟?

 import io.gatling.core.Predef._
 import io.gatling.http.Predef._
 import scala.concurrent.duration._

 class Test extends Simulation {
   val httpConf = http.baseURL("url")
   var scn = scenario("Test")
        .exec(
            http("My Other Request")
              .get("/1")
   )

   setUp(scn.inject(rampUsers(2000) over  (200 seconds)).protocols(httpConf))
 }

【问题讨论】:

    标签: performance-testing load-testing gatling scala-gatling


    【解决方案1】:

    根据Scala documentation

    简而言之,应该首选 Java 文件命名和定位约定,尽管 Scala 在这方面允许更大的灵活性。

    所以你的班级应该命名为TestSimulation,而不是Test

    如果您想按原样运行模拟,您可以提供 test 作为模拟名称,例如:

    gatling -s test
    

    它应该开始执行你的模拟,因为它在user-files/simulations 下,或者 Gatling 可以通过其他方式找到它。

    如果需要,请查看How to Run a Simple Load Test with Gatling 了解更多信息。

    【讨论】:

    • 我将运行我的模拟,例如 gatling -sf /unique-simulation-folder/ 而不使用 -s 参数,因为文件夹中只有一个模拟。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-29
    • 1970-01-01
    相关资源
    最近更新 更多