note: I am new to gatling and know almost nothing about Scala.
I am starting the process of converting my load tests from Jmeter to gatling. And I am stuck on how to organize the code base. All the examples that I have been able to find are single file examples.
How can import code from one simulation class into another?
I have this class and test scenario working now:
package default
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
class createGuestUser extends Simulation {
val userPrefix = System.getProperty("userPrefix", "gatling_load_test") + "_" + scala.util.Random.nextInt + "_"
val password = System.getProperty("password", "1234567")
val hostname = System.getProperty("hostname", "http://0.0.0.0")
val blank_headers = Map("Accept" -> "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
val httpConf = http
.baseURL("http://0.0.0.0")
object GetClientToken {
val slash = exec(http("Slash")
.get("/")
.headers(blank_headers)
.check(regex("""var appToken = '(.*)';""").find.saveAs("xGlooApplication")) // var appToken = '60e5814d-9271-43b4-8540-157d1c743651';
)
}
.....
And when I try to import the class into another simulation like this:
package default
import scala.concurrent.duration._
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import createGuestUser._
class createAccount extends Simulation {
I get the following error when trying to import.
08:33:57.952 [ERROR] i.g.c.ZincCompiler$ - /Users/dclements/Dev/Gloo/load_testing/gatling/src/createAccount.scala:9: not found: object createGuestUser 08:33:57.954 [ERROR] i.g.c.ZincCompiler$ - import createGuestUser._