, but actually found 200

I have a csv file that contains the URL and the expected status for the URL. Code is below.

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

class MySimulation extends Simulation {

object Request {

val request = exec(http(“Test”)
.check( => session(“status”).as[Int])))

val httpConf = http.baseURL(“”)

val records = csv(“data.csv”).records

val users = scenario(“Users”)
.foreach(records, “record”) {


When running the simulation I get the message shown in the subject line. It is actually shown for all expected status, like if the test expects 401 then the message would be, but actually found 401.

Thanks for the help.

try with .check(

I want to check if the returned status is the same as the expected status in the CSV file. Like for example for /foo the expected status is 200 while for /bar the expected status is 401.

See fro explanation on what you’re doing wrong.

Cool, thanks. Do you know of a possible workaround for now? Also, wouldn’t as[Int] return an Int? I confess I know very little of Scala.

Changing .check(…)) to

.check([]( => Integer.parseInt(session("status").as[String]))) worked.