0

我在试图找出 TestSimulation.scala 文件中的“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)
   )
4

1 回答 1

0

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

于 2014-11-05T13:49:33.867 回答