Hello,
I am new to Gatling and I am attempting to use sequential scenarios in a simulation but and running into a compile issue. I create the HttpProtocol, some reusable InjectionSteps, 2 different scenarios. Then in the setUp() I try to use andThen() but when I add the second scenario I am getting compile errors. I am not sure what I am missing or have wrong…in the documentation there is “parent.inject(injectionProfile)” so I maybe using OpenInjectionStep
is not correct? The issues happen at the setUp() step. And if I remove the .andThen with the second scenario, the single scenario works fine.
Errors:
“Cannot resolve overloaded method 'setUp”
and
“Type mismatch
Required: Validation[PopulationBuilder]=>NotInferredA
Found: PopulationBuilder”
Here is the chunk of code.
import io.gatling.core.Predef._
import io.gatling.core.controller.inject.open.OpenInjectionStep
import io.gatling.core.scenario.Simulation
import io.gatling.core.structure.ScenarioBuilder
import io.gatling.http.Predef.http
import io.gatling.http.protocol.HttpProtocolBuilder
import scala.concurrent.duration.DurationInt
class SequentialSimulation extends Simulation {
val httpProtocol: HttpProtocolBuilder = http
.baseUrl(“http://”.concat(“localhost”).concat(":").concat(“8080”))
.contentTypeHeader(“application/json”)
val injectionSteps : Iterable[OpenInjectionStep] = Iterable(
rampUsersPerSec(1) to (20) during(10 seconds),
constantUsersPerSec(20) during(5 seconds),
rampUsersPerSec(20) to (1) during(10 seconds))
val testScnHealth: ScenarioBuilder = scenario(“healthCheck”)
.exec("/healthCheck")
val testScnConfig: ScenarioBuilder = scenario(“config”)
.exec("/config")
setUp(testScnHealth.inject(injectionSteps).andThen(testScnConfig.inject(injectionSteps))).protocols(httpProtocol)
}
Thanks for any help!
-Greg