title: Gatling 2 - issue with foreach
body: <p>I am having issues with a test script.  Everything seems to work fine until I reach the for loop.  I am trying to perform all the actions in itemChain for each value saved to ${items}  from the login response.</p>
  
  <p>I receive the following error:</p>
  
  <pre><code>12:08:30.460 [ERROR] i.g.c.a.InnerWhile - Could not evaluate condition: Can't cast value item1 of type class java.lang.String into interface scala.collection.Seq, exiting loop
  </code></pre>
  
  <p><strong>LoginScenario.scala</strong></p>
  
  <pre><code>package stressTesting
  
  import io.gatling.core.Predef._
  import io.gatling.http.Predef._
  import Headers._
  import scala.concurrent.duration._
  import bootstrap._
  
  import io.gatling.core.session.Expression
  
  object LoginScenario {
    val  itemChain =
      exec(
        http("Test Connection")
          .post("/inbrowser/connectionCheck.html?1390234478703")
          .headers(post_header)
          .check(status.is(200))
      )
      .pause(500 milliseconds, 2 seconds)
      .exec(
        http("Save Response")
          .post("/api/tde/testresponse/save/${item}")
          .body(ELFileBody("saveResponseTemplate.json")).asJSON
          .headers(post_header)
          .check(status.is(200))
      )
      .pause(500 milliseconds, 2 seconds)
      .exec(
        http("Save Event")
          .post("/api/tde/log/testevent/${testPartToken}")
          .body(ELFileBody("saveEventTemplate.json")).asJSON
          .headers(post_header)
          .check(status.is(200))
      )
      .pause(500 milliseconds, 2 seconds)
      .exec(
        http("Heartbeat")
          .post("/api/tde/heartbeat/${testPartToken}")
          .body(ELFileBody("heartbeatTemplate.json")).asJSON
          .headers(post_header)
          .check(status.is(200))
      )
      .pause(500 milliseconds, 2 seconds)
  
  
    val scn = scenario("Login")
      .feed(csv("user_credentials.csv"))
      .exec(
        http("Login")
          .post("/api/tde/login/test")
          .body(ELFileBody("loginTemplate.json")).asJSON
          .headers(post_header)
          .check(status.is(200))
          .check(jsonPath("$.testToken").saveAs("testToken"))
          .check(jsonPath("$.testPartToken").saveAs("testPartToken"))
          .check(jsonPath("$.items[*].identifier").saveAs("items"))
          .check(jsonPath("$.items[*].assets[*].name").saveAs("assets"))
      )
  
      .exec(
        http("Get Test")
          .post("/api/tde/test/${testToken}")
          .headers(post_header)
          .check(status.is(200))
      )
  
      .exec(
        http("Get Test Part")
          .post("/api/tde/testpart/${testPartToken}")
          .headers(post_header)
          .check(status.is(200))
      )
      .exec(
        http("Get Items")
          .post("/api/tde/item/${testPartToken}/${items}")
          .headers(post_header)
          .check(status.is(200))
      )
      .foreach("${items}", "item"){itemChain }
  
      .exec(
        http("Close Test")
          .post("/api/tde/closetestpart/TIMEOUT/${testPartToken}")
          .body(ELFileBody("closeTestPartTemplate.json")).asJSON
          .headers(post_header)
          .check(status.is(200))
      )
  }
  </code></pre>
  
  <p><strong>Sample Login Response</strong></p>
  
  <pre><code>{
      "firstName": "User1",
      "lastName": "Test1",
      "testToken": "12345",
      "testPartToken": "4567",
      "test": {
          "identifier": "abc",
          "testName": "",
          "title": "",
          "level": "",
          "program": "asdf",
          "contentArea": "",
          "sessionStatus": "IN_PROGRESS",
  
      "items": [
          {
              "identifier": "item1",
          },
          {
              "identifier": "item2",
          },
          {
              "identifier": "item3",
          }
  
      ]
  }
  </code></pre>