I am considering moving to Gatling 2.0.0-M3a, but I am having issues getting a basic test working. The issue I am having is mapping values to a template file in Gatling 2. The examples below show how I achieved this in Gatling 1.5, but I can't figure it out in 2.
LoginScenario.scala - works in gatling 1.5
package StressTesting
import com.excilys.ebi.gatling.core.Predef._
import com.excilys.ebi.gatling.http.Predef._
import Headers._
import akka.util.duration._
import bootstrap._
object LoginScenario {
val scn = scenario("Login")
.feed(csv("user_credentials.csv"))
.exec(
http("login")
.post("/api/login")
.fileBody("loginTemplate",
Map(
"userName" -> "${userName}",
"password" -> "${password}"
)
).asJSON
.headers(post_header)
.check(status.is(200)))
}
LoginScenario.scala - ERRORS - Reworked version to accommodate changes between Gatling 1.5 and 2
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 scn = scenario("Login")
.feed(csv("user_credentials.csv"))
.exec(
http("login")
.post("/api/login")
.body(ELFileBody("request-bodies/loginTemplate.ssp",
Map("userName" -> "${userName}","password" -> "${password}"))).asJSON
.headers(post_header)
.check(status.is(200))
)
}
loginTemplate.ssp - Template used in both examples
{
"userName": "<%= userName %>",
"password": "<%= password %>",
"platformCode": "app",
"clientInformation": {
"operatingSystem": "OSX",
"operatingSystemVersion": "10.8",
"browser": "Chrome",
"browserVersion": "31",
}
}