Reputation: 3739
I have simple scenario that tests single endpoint. I have problems with DSL. Can't figure out how to start scenario with feeder. I have to make useless call first in order to make it compile.
class GetDataSimulation extends Simulation {
val httpProtocol = http
.baseUrl("http://localhost:8080") // Here is the root for all relative URLs
.header("Content-Type", "application/json")
.header("Accept", "application/json")
object GetData {
val feeder = csv("data.csv").shuffle.circular
val getData = exec(
http("Home")
.get("/")
) // first call .get("/") is useless. I've added it only to make it compile
.pause(1.millisecond)
.feed(feeder) // start feeder, want to start scenario from here.
.exec(
http("GetData") // interpolate params using CSV feeder.
.get("/api/v1/data?firstParam=${firstParam}&secondParam=${secondParam}")
)
.pause(1)
}
setUp(
constantUsers.inject(constantUsersPerSec(3).during(60.seconds))
).protocols(httpProtocol)
}
how can I get rid of
exec(
http("Home")
.get("/")
) // first call .get("/") is useless. I've added it only to make it compile
Upvotes: 1
Views: 2791
Reputation: 265221
feed
is available as a top level function, similar to exec
itself:
val getData = feed(feeder)
.exec(
http("GetData") // interpolate params using CSV feeder.
.get("/api/v1/data?firstParam=${firstParam}&secondParam=${secondParam}")
)
.pause(1)
You can see it in the Feeders documentation.
Upvotes: 3