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
.doNotTrackHeader(“1”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.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") )
.pause(3)
.feed(users)
.exec(
http(“postlogin”)
.post("/login_check")
.headers(headers_10)
.formParam("_username","${email}")
.formParam("_password","${password}")
.check(regex(""“

Interview Booking

”""))
)
.exec( http(“get interview times”).get("/booking/interview-times") )
.pause(1)
.exec(
http(“post interview times”) // Here’s an example of a POST request
.post("/booking/interview-times")
.headers(headers_10)
.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)
)

setUp(scn.inject(atOnceUsers(9)).protocols(httpConf))
}

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