In the feeder documentation, it mentions you can use JSON as a feeder source.
val jsonFileFeeder = jsonFile("foo.json")
val jsonUrlFeeder = jsonUrl("http://me.com/foo.json")
I can’t seem to find the right import for jsonFile. Any pointers?
Almost all feeders, except for the JDBC,Redis and Sitemap ones, are available when you import io.gatling.core.Predef._
For the other feeders :
- The JDBC feeder is available after importing io.gatling.jdbc.Predef._
- The Sitemap feeder is available after importing io.gatling.http.Predef._
- The Redis feeder is available after importing io.gatling.redis.Predef._
Just make sure you imported io.gatling.core.Predef._ and it’ll be fine
That’s what I figured. However, I’m getting the following error:
: error: not found: value jsonFile
[ERROR] val searchFeeder = jsonFile(“data/memberSearch.json”)
[ERROR] one error found
[INFO] BUILD FAILURE
I have the following imports:
I’m using 2.0.0-M3a. Is there a newer version I should be using?
Ah, 2.0.0-M3a does not ship the JSON feeders.
There is a indeed a newer version, Gatling 2.0.0-RC2, which ships the JSON feeders.
Not to mention that M3a is rather old and many bugs were fixed since then.
You should migrate to 2.0.0-RC2, until we release the stable version in September (hopefully).
There is a dedicated migration guide for moving to 2.0.0-RC2 from 2.0.0-M3a : http://gatling.io/docs/2.0.0-RC2/project/migration_guides/2.0.0-M3a-to-2.0.0-RC2.html#m3a-to-2-0-rc2
Don’t hesitate to ask questions in this group should you need some help during migration
Thanks for the tip. I’ve attempted to migrate my project to 2.0.0-RC2. However, I get the following compilation error:
Error:(19, 17) type mismatch;
found : String(“text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8”)
required: io.gatling.core.session.Session => io.gatling.core.validation.Validation[String]
What needs to change in my http configuration? Here’s my full definition:
val host = System.getProperty(“host”, “localhost:8080”)
val httpProtocol = http
.baseURL(“http://” + host)
That’s rather strange…
As long as io.gatling.core.Predef._ is imported, an implicit conversion should kick in and convert your String to an Expression[String], which is an alias for Session => Validation[String].
I was missing that import - thanks for the tip. Migration complete!