1
votes

I run the gatling with ./gatling.sh -s className command. But class name can be different from simulation file name. For Example The simulation name below is Test,but scala file name can be different.The file name is TestSimulation.scala. How can I run the simulation with file name?

 import io.gatling.core.Predef._
 import io.gatling.http.Predef._
 import scala.concurrent.duration._

 class Test extends Simulation {
   val httpConf = http.baseURL("url")
   var scn = scenario("Test")
        .exec(
            http("My Other Request")
              .get("/1")
   )

   setUp(scn.inject(rampUsers(2000) over  (200 seconds)).protocols(httpConf))
 }
1

1 Answers

2
votes

According to Scala documentation

In short, the Java file naming and positioning conventions should be preferred, despite the fact that Scala allows for greater flexibility in this regard.

So your class should be named TestSimulation, not Test

If you want to run your simulation as it is you can provide just test as the simulation name like:

gatling -s test

and it should start executing your simulation given it is under user-files/simulations or Gatling can find it somehow else.

Check out How to Run a Simple Load Test with Gatling for more information if needed.