Querystring parameters

Hi,

I am just getting started with Gatling and am using an http access log as a feeder. Many of the entries are urls with querystring params, but simply doing a get does not include the querystring.

e.g. get(“http://foo.com/bar?a=b”) results in a request to “http://foo.com/bar

I see in the docs the queryParam method (https://github.com/excilys/gatling/wiki/HTTP#wiki-query-params), but how do I dynamically create these based on the values from the feeder?

Here’s my feeder:

val logFeeder = new Feeder[String] {
val source = scala.io.Source.fromFile(accessLog).getLines

override def hasNext = source.hasNext

override def next: Map[String, String] = {
val fields = source.next.split(" ")
val method = fields(5)
val path = fields(6)

if (method == "“GET”)
Map(“ip” → ip, “path” → path)
else
Map()
}
}

and a scenario

val scn1 = scenario(“scn1”)
.repeat(1000) {
feed(logFeeder).exec(
http(“accessLog”)
.get("${path}")
.check(status.is(200))
)
.pause(10 milliseconds, 100 milliseconds)
}
}

Thanks for any help

Rob

Hi,
Which version of gatling are you using?
get("http://foo.com/bar?a=b") is a valid syntax.

cheers
Nicolas

Hi,

Which version do you use?

I just ran a basic test with both Gatling 2 master and 1.5.2 and it work as expected:

package basic

Sorry should have said, I’m using 2.0.0-M1.

I just tried the example you provided and the check failed. (had to modify it a bit, see below (httpConfig not http and protocolConfig not protocols) - guess the master has changed since M1)

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import io.gatling.http.Headers.Names._
import scala.concurrent.duration._
import bootstrap._
import assertions._

class test extends Simulation {

val httpConf = httpConfig
.baseURL(“https://www.google.fr”)
.acceptHeader(“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.acceptEncodingHeader(“gzip, deflate”)

val scn = scenario(“Google”)
.exec(http(“Hello”).get("/search?q=hello").check(regex("""

""")))

setUp(scn.inject(atOnce(1)).protocolConfig(httpConf))
}

I’ll try with master instead.

Thanks
Rob

I fixed that in Gatling 2.0-M2.
https://github.com/excilys/gatling/commit/53cb46bc3f46c9b4692380f6ee798c0785aedcfc

Could you update your code to use Gatling 2.0-M3 ?

Fantastic, and thanks a lot for the quick responses!