Questions about gatling -s option

I am new to gatling and scala and need some help.

I ran the recorder with Package set to nothing and Class Name set to AAA.

It produced a recorder simulation in ./user-files/simulations/AAA.scala

To run this simulation I did:

./bin/gatling -s AAA

It seemed to run the right simulation as expected.

Then I copied AAA.scala to AAA2.scala (in the user-files/simulation directory) and edited it to add more users. I even changed the class in the scala code from AAA to AAA2

I’m trying to produce 2 separate simulations, in 2 separate files, one which creates a load of about 10% and the other of 80%.

When I run with -s to specify the file I want to use it doesn’t seem to do what I expect. It always seems to use the more recent one?

For example, this command now runs the new AAA2.scala???
./bin/gatling -s AAA

Can someone explain what -s really does. I assumed it used the -s to look for a filename in user-files/simulations with that name but it doesn’t seem to do that? When you use words like “Class Name” please explain where in the code or the filename that comes from?

Thanks,
Js

No Java background either I guess :slight_smile:

In Scala, file name and class name are not really related.

What the -s option targets is the Class name:
(package.)SimpleClassName

package is optional (you claim you don’t have one)
SimpleClassName is the name you define inside the file:

class SimpleClassName extends Simulation

Thanks. Can I use -s without a package name? I’m assuming that -s was not the right answer since it didn’t work.
Do I add the dot? -s .AAA

I switched to not using the package name because my goal is to:

  1. start the simulation with gatling.sh -s AAA -nr
  2. kill it after a while
  3. run gatling.sh with -ro

I could not figure out the format for the argument to -ro when I used a package name. Would it be “p.AAA” ? I couldn’t get it to work so I stopped using a package name.

Thanks for the help.
Js

Thanks. Can I use -s without a package name?

yes

I'm assuming that -s <Class name> was not the right answer since it didn't
work.

my2cents: you messed up when you renamed the files and the class names. You
might have a duplicate.

Do I add the dot? -s .AAA

No

I switched to not using the package name because my goal is to:
1) start the simulation with gatling.sh -s AAA -nr
2) kill it after a while

Not that great, you might have dandling resources.

3) run gatling.sh with -ro

I could not figure out the format for the argument to -ro when I used a
package name. Would it be "p.AAA<timestamp>" ?

No, just "AAA<timestamp>" without the package

It is possible that I messed up the class names and the files but I don’t think so. I will go check again right now!

I have a question about case sensitivity. When my class name was Aaaa and I passed the -ro option to gatling.sh, I had to lowercase the Aaaa to aaaa to get it to work. I mean I passed -ro aaaa and it worked but -ro Aaaa said it could not find a matching results. Does that make any sense at all to you? I’m running on Unix.

Yes, the name is converted to lowercase when generating the directory.
This limits messes for people running under Windows.

I solved the problem I was having. The key was that you told me that the class name comes from the .scala file. Therefore, it reads all the .scala files in the user-files/simulations directory to find the one I asked for. I had a bad .scala file that I was working on that had a syntax error in it. So it looked like it was always choosing the one with the syntax error regardless of what I asked for.

I removed the bad one and it started working as I expected again.

Thanks.

Glad to hear you solved this.

Good luck!