There was an occasion when we wanted to run our full test suite using Gatling in the command line to measure few metrics. We did not want to use a build tool but wanted to execute on a remote server in background, so that we do not get disconnected and kill the test if the remote session is lost.
On the remote machine , we used sbt (but similar command can be used for maven or gradle builds).
- In the build root folder (If in our case the simulation to run is : computerdatabase.BasicSimulation)
mkdir -p simlogs ; setsid nohup gatling:testOnly computerdatabase.BasicSimulation > simlogs/simlog-`date +%Y-%m-%d-%H-%M`.log &
- 1 > We are using the linux `setsid` (setsid — creates a session and sets the process group ID)
- 2 >We are creating a folder and creating the logfile with datetimestamp.
- 3 > You can tail the logs to view the live stats OR come back later .