Reputation: 53
I am writing a load test with Gatling for a REST web service. The service's endpoint receives a parameter in the path like this:
http://localhost:8080/api/v1/palindrom/revert/{word}
I am not familiar with Gatling but have to make that test ASAP. I tried different solutions but do not understand how can I provide {word}
parameter taken from the list or file.
For the moment my code is like this:
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
class MultiRequest extends Simulation {
private val baseUrl = "http://localhost:8080"
private val endpoint = "/api/v1/palindrom"
val httpProtocol = http
.baseUrl(baseUrl)
.inferHtmlResources()
.acceptHeader("*/*")
.contentTypeHeader("application/json")
.userAgentHeader("gatling/3.3.1")
val fullUrl = baseUrl + endpoint + "/word"
val scn = scenario("Revert_1")
.exec(http("Request_1")
.get(fullUrl)
.check(status.is(200)))
setUp(
scn.inject(
nothingFor(2),
atOnceUsers(100),
rampUsers(100) during (60)
)
).protocols(httpProtocol)
}
With the code above the test runs 200 requests but always with the same parameter (word
)
I do not understand how to provide a list of 50 words to be taken randomly 200 times. Could you pleas help?
Please, understand that the service endpoint here is just an example for the question and not a real one.
Upvotes: 0
Views: 601
Reputation: 6598
You should check the tutorials, there's exactly what you're looking for: feeders and Gatling EL:
The above links are dead (converted to web archive links); below are the links to the current version of the page:
Upvotes: 1