Trying to run a gatling 3.0.2 with a neat exetension method that I have been using many times before with gatling 2.2.x
implicit class Extensions(val scenario: ScenarioBuilder) extends AnyVal {
def injectDefaults: PopulationBuilder =
scenario.inject(
rampUsersPerSec(RAMP_USER_PER_SEC) to LOAD_FACTOR during (RAMP_UP_TIME seconds),
constantUsersPerSec(LOAD_FACTOR) during (DURATION seconds)
)
}
But it no longer compiles, it fails with:
could not find implicit value for evidence parameter of type
io.gatling.core.controller.inject.InjectionProfileFactory[Product with Serializable with io.gatling.core.controller.inject.open.OpenInjectionStep]
scenario.inject(
Anyone knows why?
Found the solution myself, was missing some implicit import. Here is the full code sample:
import io.gatling.core.Predef.{constantUsersPerSec, rampUsersPerSec,_}
import io.gatling.core.structure.{PopulationBuilder, ScenarioBuilder}
import scala.concurrent.duration._
object Config {
val LOAD_FACTOR: Double = 50
var RAMP_UP_TIME: Int = 10
val RAMP_USER_PER_SEC = 0.1
implicit class Extensions(val scenario: ScenarioBuilder) {
def injectDefaults: PopulationBuilder =
scenario.inject(
rampUsersPerSec(RAMP_USER_PER_SEC) to LOAD_FACTOR during (RAMP_UP_TIME seconds),
constantUsersPerSec(LOAD_FACTOR) during (DURATION seconds)
)
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.