How do you run multiple karate feature file in a gatling simulation?

unclelim12

How do you run multiple karate feature file in a gatling simulation?

The following is my code snippet for my gatling simulation:

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)
  )
}

I'm only able to run one feature file each time like this:

./gradlew -Pgatling_simulation=performance.TestGatlingScalaSimulation -DSIM_ACTIVE_USERS=100 -DSIM_RAMP
_UP_PERIOD=10 -DSIM_FEATURE="karate/flight/myfeature.feature" gatlingRun
Peter Thomas

This is described clearly in the docs: https://github.com/intuit/karate/tree/master/karate-gatling#usage

val create = scenario("create").exec(karateFeature("classpath:mock/cats-create.feature"))
val delete = scenario("delete").exec(karateFeature("classpath:mock/cats-delete.feature@name=delete"))

setUp(
  create.inject(rampUsers(10) during (5 seconds)).protocols(protocol),
  delete.inject(rampUsers(5) during (5 seconds)).protocols(protocol)
)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to run a Karate Feature file after a Gatling simulation completes

@karate How to pass parameter to a feature file in gatling simulation class?

Karate - how to run multiple scenarios in a single feature file parallely?

Can we run multiple feature files in the same package using Karate-gatling

How to run Karate and Gatling with Gradle build system

How to run the feature file for definite number for times in karate framework?

Karate Gatling: Changes to feature file aren't picked up

How to merge multiple feature file in mock server using karate?

How to loop with in the feature file in karate

Unable to run karate tests - feature file not found

karate-gatling: how to simulate a karate feature except those scenarios tagged with @ignore

How do you expose gatling assertions in the gatling reports?

How to call a feature file inside a for loop in karate?

how to pass body type in Karate feature file?

How to use custom path in karate feature file?

How do you achieve a stress test in Gatling?

How to validate API response against multiple instance of data base from feature file in Karate API automation?

How do you run an .exe file on Docker?

How to run multiple feature file in behave using pycharm professional

Does karate use interpreter or complier to run the feature file based code?

Using mocks in Karate DSL feature file with stanalone run

karate-gatling: how to force a sequential execution of all existing feature files in parallel even if one of them fails?

how do I match the boolean values coming from the external method in karate feature file

How to Invoke Gatling successfulRequests Assert for All Feature File Requests

Returning Variable from Feature File With Multiple Scenarios - Karate

Karate-Gatling: Callonce does not run

Run Gatling tests with karate.jar

How to use two or more csv file in a single feature file in karate?

Karate - How to call multiple external features from a single main feature