Gatling gradle plugin - gatling specific task

Hello, everyone!

I have a question. I see a lot of tutorials on the official site on how to execute a simulation with the Gatling Gradle plugin. But I have the following question.

Can I create a specific gatling-type task and pass the parameter inside? For example:

task mySpecificTaskOne(type: gatling) {
    simulations = {
        include "**/com/my/first/package/**"

task mySpecificTaskSecond(type: gatling) {
    simulations = {
        include "**/com/my/second/package/**"

Why I need this solution?

  • I want to divide the execution of simulations into packages and simplify the launch command from this one:
  • ./gradlew gatlingRun-singleFirstSimulation…
  • ./gradlew gatlingRun-singleN…Simulation

to another one, just run two or whatever I want tasks:

  • /.gradlew mySpecificTaskOne
  • /.gradlew mySpecificTaskSecond


Does creating a task that depend to gatlingRun-singleFirstSimulation task can do the trick?

tasks.register('mySpecificTask') {
  dependsOn 'gatlingRun-singleFirstSimulation'

More information on Gradle - Authoring Tasks documentation.


1 Like

Thank you very much! Yeap, it’s working for now! This is what I need :slight_smile: