forked from karatelabs/karate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CatsSimulation.scala
28 lines (20 loc) · 901 Bytes
/
CatsSimulation.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package mock
import com.intuit.karate.gatling.PreDef._
import io.gatling.core.Predef._
import scala.concurrent.duration._
class CatsSimulation extends Simulation {
MockUtils.startServer(0)
val protocol = karateProtocol(
"/cats/{id}" -> Nil,
"/cats" -> pauseFor("get" -> 15, "post" -> 25)
)
protocol.nameResolver = (req, ctx) => req.getHeader("karate-name")
val create = scenario("create").exec(karateFeature("classpath:mock/cats-create.feature"))
val delete = scenario("delete").exec(karateFeature("classpath:mock/cats-delete.feature@name=delete"))
val custom = scenario("custom").exec(karateFeature("classpath:mock/custom-rpc.feature"))
setUp(
create.inject(rampUsers(10) during (5 seconds)).protocols(protocol),
delete.inject(rampUsers(5) during (5 seconds)).protocols(protocol),
custom.inject(rampUsers(10) during (5 seconds)).protocols(protocol)
)
}