Как запустить файл нескольких карате в симуляции Гатлинга?
Ниже приведен мой фрагмент кода для симуляции Гатлинга:
class TestGatlingScalaSimulation extends Simulation {
val log: Logger = LoggerFactory.getLogger(classOf[TestGatlingScalaSimulation])
/*val environmentVars = System.getenv().asScala
for ((k,v) <- environmentVars) println(s"key: $k, value: $v")*/
val properties: mutable.Map[String, String] = System.getProperties.asScala
//for ((k,v) <- properties) println(s"key: $k, value: $v")
val activeUsers: Int = properties.getOrElse("SIM_ACTIVE_USERS", "10").asInstanceOf[String].toInt
val rampUpPeriod: Int = properties.getOrElse("SIM_RAMP_UP_PERIOD", "10").asInstanceOf[String].toInt
val karateFeatureFile: String = properties.getOrElse("SIM_FEATURE", "karate/example.feature")
val protocol: KarateProtocol = karateProtocol()
protocol.nameResolver = (req, ctx) => req.getHeader("karate-name")
val create: ScenarioBuilder = scenario("create").exec(karateFeature(s"classpath:$karateFeatureFile"))
log.info("Running simulation of feature [{}] with [{}] users ramped up in [{}]", karateFeatureFile, activeUsers.toString, rampUpPeriod.toString)
setUp(
create.inject(rampUsers(activeUsers) during (rampUpPeriod seconds)).protocols(protocol)
)
}
Я могу запустить только один каждый раз такой файл:
./gradlew -Pgatling_simulation=performance.TestGatlingScalaSimulation -DSIM_ACTIVE_USERS=100 -DSIM_RAMP
_UP_PERIOD=10 -DSIM_FEATURE="karate/flight/myfeature.feature" gatlingRun