executing a chain of objects when a condition is met.

val scn = scenario("RecordedSimulation")

.

.

.

.check(bodyString.saveAs("TextBody"))

.exec( session => {
  if (session( "TextBody" ).as[String].contains("submit")){
  *exec(object1.chain1, object2.chan2, object3.chain3, object4.chain4)*
  //object1.chain has a chain of HTTP requests.
}else if (session( "TextBody" ).as[String].contains("clear")){
  println("This program is 201")

*exec(object5.chain5, object6.chan6, object7.chain7, object8.chain8)*
}
session
})

setUp(scn.inject(rampUsers(2000) over (3600)).protocols(httpProtocol))

This is what i am trying to do, check the response body for "submit" and "clear" and

if textbody contains submit execute object1 to 4 or else execute object5 to 8 for a each user

When i tried like above, it doesn't execute the object chains.

Hi,

you could check the documentation for the conditional statements: http://gatling.io/docs/2.1.6/general/scenario.html#conditional-statements

best regards
Niko