Good day,
Running into an issue reading a file from the resources folder in my Scala code. I’m trying to read the files as a classpath resource from the classpath root as noted in https://gatling.io/docs/current/session/feeder/?highlight=resources#file-based-feeders as number 1 option. However, when I run it with the gatling.sh and pass the path via -rsf it can’t find the file. I can do it with options 2 and 3. Option 2 by using System.getProperty(“user.dir”) or the java.nio.file.Paths. Both work equally well locally.
Here’s a successful example of the user.dir after copying the resource file to the user-files/resources folder under the GATLING_HOME location and running the gatling.sh script with just the -rf and -s options: val BODY = StringBody(scala.io.Source.fromFile(System.getProperty(“user.dir”) + “/user-files/resources/MyFile.json”).getLines().mkString)
I can also run it just fine from gradle with the ‘com.github.lkishalmi.gatling’ plugin running. The following command where the file is located in the src/test/resources folder of the project: val BODY = StringBody(scala.io.Source.fromResource(“MyFile.json”).getLines().mkString).
What it feels like I’m missing is that the value passed in -rsf is a property somewhere, but I don’t know how to reference it. I’ve been searching around quite a bit and working with different options in the code and have come up empty.
Thanks!
Joe