Search code examples
scalavisual-studio-codecommand-linegatling

Gatling.bat Command-line options, how do they work?


When I add the command-line option "-simulation" as per the Gatling web site to the "gatling.bat" file, which comes as part of the "gatling-charts-highcharts-bundle-3.3.1" download. I get an error saying "Warning: Unknown option -simulation"

I don't understand why?

Im using Visual Studio Code and running "gatling.bat" from the Powershell Terminal window. If i don't put any command-line options it runs as expected.

Here is some of my code and galting website screenshots

Gatling Website Screensots

  • Note it says that Gatling can be started enter image description here

My Simulation Code

Note the classname is "AllTests"

package api

//Import API Object's to include in test
import api1.{foo => foofoo}
import api2.{bar => barbar}

//Gatling and Scala imports
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
import java.util.concurrent.ThreadLocalRandom
import com.typesafe.config._

class AllTests extends Simulation {
/*   
  val conf = ConfigFactory.load("application.conf");
  val baseUrl = conf.getString("base-app.baseurl")
*/
  val httpProtocol = http
    .baseUrl("https://api.accp.qqq/")
    .header("Sec-Fetch-Site","same-origin")
    .header("Sec-Fetch-Mode","cors") 
    .header("Sec-Fetch-Dest","empty")
    .acceptHeader("application/json")
    .acceptLanguageHeader("en-US,en;q=0.9")
    .acceptEncodingHeader("gzip, deflate, br")
    .userAgentHeader("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36 Edg/86.0.622.38")

  setUp(
    foofoo.users.inject(atOnceUsers(1)),
    barbar.users.inject(atOnceUsers(1))
  ).protocols(httpProtocol)
}

Here is the "gatling.bat" with the command-line option

Note the warning

C:\Users\xxx\source\perfrepo\Test01\bin> .\gatling.bat -simulation AllTests
GATLING_HOME is set to "C:\Users\xxx\source\perfrepo\Test01"
JAVA = ""C:\Program Files\Java\jdk-11.0.2\bin\java.exe""
Warning: Unknown option -simulation
Warning: Unknown argument 'AllTests'
Choose a simulation number:
     [0] computerdatabase.advanced.AdvancedSimulationStep01
     [1] computerdatabase.advanced.AdvancedSimulationStep02
     [2] computerdatabase.advanced.AdvancedSimulationStep03
     [3] computerdatabase.advanced.AdvancedSimulationStep04
     [4] computerdatabase.advanced.AdvancedSimulationStep05
     [5] api.AllTests

Solution

  • That's a error in our documentation generation, where -- (double dashes) were transformed into single ones (see doc sources).