Hey Gang, I need some help converting a gatling-scala script I wrote a long time ago into gatling-java. I’m struggling a bit with it because I haven’t used java in a long time. The script references a few scenarios and the tester then selects which scenario set to run when starting from cli. I’ve attached an example version of it here:
package com.performance.team.simulations.example
import io.gatling.core.Predef._
import com.performance.team.config._
import com.performance.team.scenarios._
import scala.concurrent.duration.DurationInt
import scala.language.postfixOps
class ExampleSimulation {
val httpScenarios = Map (
"attachUserToSiteByID" -> List(
Users.scnAttachUserByIDScenario.inject(atOnceUsers(1)).protocols(httpConf)
.andThen(SiteScenario.scnSiteScenario.inject(rampUsers(5).during(25 seconds))
),
"searchAndDeleteUserByID" -> List(
Users.scnSearchAndDeleteUserByIDScenario.inject(atOnceUsers(1))
),
"someOtherRandomScenario" -> List (
Load1Scenario.scnWorkspace.inject(nothingFor(5 seconds), rampUsers(Constants.userCount / 3) during(Constants.rampDuration seconds)),
Load1Scenario.scnPants.inject(nothingFor(5 seconds), rampUsers(Constants.userCount / 3) during(Constants.rampDuration seconds)),
Load1Scenario.scnTshirts.inject(nothingFor(5 seconds), rampUsers(Constants.userCount / 3) during(Constants.rampDuration seconds))
)
)
setUp(httpScenarios(UserDefinedConfig.testScenario):_*) //testScenario is configured in a config file before run
.protocols(httpConf)
.assertions(global.responseTime.percentile4.lte(Constants.responseTimeLTE),
global.successfulRequests.percent.gte(Constants.successRateGTE))
}
Please let me know if this is too vague or if you need more information…I’ve been struggling with this for a day or two.
Thanks for any help you guys can lend!