Gatling for Batch process trigger/execution

Hi,
We’ve recently started gatling for our perf-test execution as an alternative to LoadRunner based tests. So far the experience is pretty good. Thanks for this great tool.

Is there any option to enable or trigger a batch process from within a simulation?

Usecase:

We have UI or REST service tests which run and in between we want to load or run our scheduled jobs at regular intervals. In LoadRunner world, this is not possible, so we do this manually when the LoadRunner execution happens. Was wondering if some option is available to just allocate a vUser at some time to make a ‘java’ method call and wait on it until it completes. I’m aware that gatling will not be able to trap the request/response timing etc for such scenarios, but detailed level of analysis is gathered via our perf-logs.

Thanks,
Jebu.

Hi,

What are you trying to achieve exactly? Init some data prior to running the actual test?
Gatling simulations are Scala code, so you can plug there whatever you want.

Sorry for the delayed response.

No. Not loading pre-requisite data, but simulating a production usecase where batch-processes could be running in parallel to UI/API transactions. The batch-processes are normally triggered via a Java command-line. So wondering if there is an simple exec() example which invokes a Java method instead of bundling it into a http request call.

i.e few users will be just assigned to call the java-method which does batch-processing.

scenario(“batch-trigger”)
.during(10 minutes)(
exec(?? – how to call the java-method here)
).inject(rampUsers (1) over (10 minutes))

Thanks,
Jebu.

This should do it:

.exec( { session => /* call the java function */ } )

Just beware that your trigger is non blocking. If it’s not, wrap it and execute it in its own thread pool.