Project setup for benchmarking arbitrary scala

I’d like to use Gatling for testing some stuff other than http. Looking at other extensions, it seems like the usual way to do this is to generate a jar with the code you need, and drop that jar in the lib dir of the gatling bundle. If your code has dependencies though, you have to be careful to also include all the dependency jars, while carefully excluding duplicate jars like scala-lib or logging libraries, and so forth.

I’m getting tired of doing this though. Rather than manually track dependencies and carefully copy jars around, what I’d prefer is proper dependency management. I’m already a scala developer, I don’t mind editing a build.sbt to include the stuff I want.

Is there a way to programmatically run gatling? Can I create a top-level project, include a gatling library (and whatever else) as a dependency, write a Simulation class, and write a little code to mimic the command line script as a main class?

Thanks.

Hi Jeff,

You could use the maven archetype as a reference for the Scala to initialise and run Gatling programatically.

http://gatling.io/docs/2.2.3/extensions/maven_archetype.html

I used v2.2.0 of the archetype but changed the POM to point to latest Gatling & Scala versions

Hope that helps

Rich

That’s where I ended up.
A lot of the entry points are marked private, but the one that the bundle uses (Gatling.main) was not. So I created a main class that creates an arguments array, and passes that to the same method that the bundle’s bin script uses.
Seems to work. Actually, it took me longer to make scaffolding around the the right bits of framework such that I could benchmark an arbitrary client/function. Maybe I missed it, but I was a little surprised that such a thing didn’t already exist.

Thanks.