Sequential Scenario Compile Issue

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

This code compiles just fine. Are you sure you’re using a modern version? Latest is 3.5.1.

Hi

mmm that does sound tricky.

what im going to do is ask a few questions and get an understanding
Questions

  • What were the errors you received on compilation?

  • With this baseUrl(“http://”.concat(“localhost”).concat(":").concat(“8080”)) can it not be written like this instead to minimize typo risk

  • With the val testScnHealth: ScenarioBuilder = scenario(“healthCheck”).exec("/healthCheck")

  • can it not be written like this instead to minimize typo risk scenario(“My Scenario”) .exec(http(“Get Homepage”).get("/healthcheck"))

Thanks
Jason

Welp, I must of overlooked the sequential functionality being in 3.4+ (missed what doc version I was using). I was on 3.3. Upgraded to 3.5 and it worked (along with some other required updates).
Thanks for pointing it out and apologies if I wasted your time.