dynamic form

Hello, I’ve recently found gatling.io. Its pretty awesome. I’ve got one issue. I’m trying to build a test scenario to load test one part of a system. A user logs in, and then selects one 9 radio buttons. As the system continues one of each of those may no longer be available. So I’m wondering how I go about submitting a form based on the options that are available? I presume I would use some regex/check but I can’t seem to find anything doing anything like this. Here’s my simulation as it stands now. the last line where I set slot_booking[block] to 12.

package carms

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._

class BasicSimulation extends Simulation {

val users = csv(“users.csv”).random

val httpConf = http
.baseURL(“http://carms”) // Here is the root for all relative URLs
.acceptHeader(“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”) // Here are the common headers
.acceptEncodingHeader(“gzip, deflate”)
.userAgentHeader(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0”)

val headers_10 = Map(“Content-Type” → “application/x-www-form-urlencoded”) // Note the headers specific to a given request

val scn = scenario(“Login and book”) // A scenario is a chain of requests and pauses
.exec( http(“getlogin”).get("/login") )

Interview Booking

.exec( http(“get interview times”).get("/booking/interview-times") )
http(“post interview times”) // Here’s an example of a POST request
.formParam(“slot_booking[attendingCarmSocial]”, 0) // Note the triple double quotes: used in Scala for protecting a whole chain of characters (no need for backslash)
.formParam(“slot_booking[block]”, 12)


You’ll have to implement this logic on your side.
Note that the new “form” component could help: http://gatling.io/docs/2.2.0/whats_new/2.2.html#forms-support