How to create a jar file for Gatling gRPC Load test with only test class

184 Views Asked by At

I am using the code from https://github.com/alexromanov/gatling-grpc-tests-sample i have added new protobuf under src/main and added a newSimulation.scala under src/test/scala/load. The code works fine and able to run. Now the problem i want a jar that can execute the newSimulation.scala

so my 2 questions?

  1. is there a way we can create a jar using which i can run the load test script
  2. If not how can i write a main class which may invoke the tests from there

Thanks

i tried sbt assembly and sbt test:assembly dont think that it worked, as it kept asking me for a main class.

2

There are 2 best solutions below

1
Dmytro Mitin On
4
George Leung On

is there a way we can create a jar using which i can run the load test script

If you want to create a executable jar, this is not supported usage.

Gatling has a set of official launchers: zip bundle, maven, sbt, gradle and FrontLine.

However, if you want to, it's doable. There's already another question asking for the exact same thing. Gatling sbt assembly- jar file cannot created?


If you upgrade your Gatling SBT plugin, you can simply run sbt Gatling/enterprisePackage. That task creates a fat jar in the target/gatling directory.

Move that jar to lib/ in the Gatling bundle.
You can start the simulation by calling ./bin/gatling.sh -s load.GrpcSimulation.

Since the sample repo is pretty old, you will have to also upgrade quite a lot of things (e.g. sbt, other sbt plugin(s), libraries versions) to upgrade the Gatling SBT plugin.