Running Gatling CLI for external folder simulations

Hi,

I have been trying to use Gatling for running tests from an folder external to where Gatling is .

Example :

GATLING FOLDER : C:\Tools\gatling

TESTS_FODER : C:…\Desktop\GUD

this folder contains folders data , request-bodies, simulations. The reports folder is auto generated when ran from CLI.

I am able to run the following command

[ from inside bin\folder]

gatling.bat -df C:…\Desktop\GUD\data -rf C:…\Desktop\GUD\reports -bf C:…\Desktop\GUD\request-bodies -sf C:…\Desktop\GUD\simulations

But when trying to run -s advanced.AdvancedLoopDataSimulation in addition to the above command :

It Throws An Error :
Error: missing value after -s

Which version do you use?

The version of Gatling is 1.5.2

I can’t reproduce on OS X and won’t be able to get my hands on a Windows machine, sorry.
Can anybody else help?

Hi,
I want to do a similar thing as Vaikuntham - start test cases from Ant script. But when I execute “gatling.bat -df … - rf … -bf … -sf …” Gatling doesn’t recognize these parameters. I checked Gatling.bat and it seems that it doesn’t accept any parameters.
Is there a way to run Gatling scripts from outside the Gatling home file tree structure?

Best regards,
Marko

Hi Marko,

I think you can do that;But if you run it that way it still asks you to specify which simulation to be run. If you try specifyiing the gatling.bat -df … - rf … -bf … -sf … with an -s option it breaks. It tries to search in the default gatling location.

Hi,

The problem is that, currently, gatling.bat only support up to 9 command line parameters. 9 parameters covers : -df … -rf … -bf … -sf … -s, but not the simulation name after -s.
It’s kind of a limitation of batch scripts, but I think we can overcome it.
No wonder Stéphane couldn’t reproduce on Mac OS X, as it only happens with gatling.bat, therefore on Windows.
I’ll see if we can do something about it.
As a workaround, if you don’t often switch folders for df / rf / bf / sf, you can always modify the default folders in gatling.conf.
The corresponding keys in gatling.conf are :

  • df : gatling.core.directory.data
  • rf : gatling.core.directory.results
  • bf : gatling.core.directory.requestBodies
  • sf : gatling.core.directory.simulations
  • s : gatling.core.simulationClass
    Setting only one of these folders in gatling.conf would make enough room on the command line to allow -s to work :wink:

Cheers,

Pierre

The problem I had was due to the relative paths I used. I noticed that soon after posting here (doh!). But then I ran into the problem with “-s”.
Now it’s clear what’s going on. Thanks!

@Pierre Any update on this Windows/-s stuff?

The 9 parameters can be overcome using SHIFT, which shifts params ids by one each time it’s called : %1 becomes %0, %2 becomes %1, etc…

However, using SHIFT is interesting only if parameters can be immediately handled.
For example, this could work for a script which renames folders :

  • The first folder name is read from the first argument, %1
  • The folder gets renamed
  • Args are SHIFTed
  • The second folder name is read from the second argument, which is now %1 after the shift
  • etc…
    However, it looks like we can use %* to pass arguments to Gatling, as we don’t need to process arguments in the .bat script.

Good news : %* did the trick, and it’s fixed on master on 1.5.X.
To get this fix before the next release, you can replace your current gatling.bat by :

Or you can edit gatling.bat yourself and replace “%1 %2 %3 %4 %5 %6 %7 %8 %9” by “%*” :

  • on line 62 for Gatling 1.5
  • on line 46 for Gatling 2.0-M3

Cheers,

Pierre

Nice work!