【问题标题】:Gatling 2.0: Failed to invoke setUp methodGatling 2.0:调用 setUp 方法失败
【发布时间】:2014-11-05 09:14:40
【问题描述】:

我在尝试找出 TestSimulation.scala 文件中的“setUp”方法出了什么问题时遇到了问题。它抛出错误 "Cannot resolve symbol setUp" 从 Intellij 13.1.5,它表明我有 2 种类型的“声明”可以从 Simulation.class 文件中选择,如下所示。选择任何一个似乎都不能解决问题。请帮忙。

模拟类:

    package io.gatling.core.scenario
    abstract class Simulation() extends scala.AnyRef {
     ....
    def setUp(scenarios : io.gatling.core.structure.PopulatedScenarioBuilder*) : Simulation.this.SetUp = { /* compiled code */ }

class SetUp() extends scala.AnyRef {
    ....}
    def setUp(scenarios : scala.List[io.gatling.core.structure.PopulatedScenarioBuilder]) : Simulation.this.SetUp = { /* compiled code */ }
    }

TestSimulation.scala:

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

class TestSimulation extends Simulation {

  val httpProtocol = http
    .baseURL("http://xx.xx.x.xx")
    .inferHtmlResources(BlackList(""".*\.css""", """.*\.js""", """.*\.ico"""), WhiteList())
    .acceptHeader("""*/*""")
    .acceptEncodingHeader("""gzip,deflate,sdch""")
    .acceptLanguageHeader("""en-US,en;q=0.8""")
    .contentTypeHeader("""application/x-www-form-urlencoded""")
    .userAgentHeader("""Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36""")

  setUp(
    SimReplacement.scn
      .inject(rampRate(5 usersPerSec) to (100 usersPerSec) during (5 minutes))
      .protocolConfig(httpProtocol)
   )

【问题讨论】:

    标签: scala intellij-idea gatling


    【解决方案1】:

    您确定您的项目以正确的 Scala 版本为目标(Gatling 2.0 为 2.10,master/upcoming 2.1 为 2.11)?

    【讨论】:

    • 我的 scala 库包含以下类和源: scala-2.10.2\src\scala-actors-src.jar scala-2.10.2\src\scala-library-src.jar scala-2.10.2\src\scala-swing-src.jar
    • 你确定你的模块有 Scala 方面吗?
    猜你喜欢
    • 2011-05-25
    • 1970-01-01
    • 2018-07-06
    • 1970-01-01
    • 2021-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多