Hi all!
I’ve run across a problem I’m sure is caused by me being new to Scala and Gatling. I’m trying to count the number of instances of a substring in a JSON response. However, my script seems to only be able to recognize one or zero occurrences of any substring in the response I’m getting. It seems that what I’m trying to do should be supported according to the docs here: http://gatling.io/docs/2.1.4/http/http_check.html#http-response-body, so I’m baffled as to what I’m doing wrong.
Here is my code:
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import util.Random
class GetOne extends Simulation {
/* headers and credentials omitted */
val scn = scenario(“populate”)
.repeat(1) {
feed(userCreds)
.exec(http(“request - login”)
.post("")
.headers(headers_login)
.exec(http(“get offers”)
.get("<api_url>")
.headers(headers_save_deal)
.check(substring(“total”)
.count
.is(5))
)
.exec(flushSessionCookies)
}
setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
}
The test generates this output:
---- Errors --------------------------------------------------------------------