Using Gatling 3.3.1, I am struggling to find any model project in GitHub or elsewhere that demonstrates running Gatling as a dependency in a Gradle project.
I just want to run my simulations in Jenkins by executing a Gradle task and no matter what I try, Gatling is not able to find my simulations. Running a Gatling project from IntelliJ using Maven is fine but using JavaExec with my build.gradle cannot find my simulations.
Finding a single simulation by full package name is also fine, my issue is just conveying to Gatling via Gradle the folder containing all my simulations.
Using the code below with my simulation in my project at the spot shown in the screenshot, Gatling finds nothing reporting as shown below.
I am new to Gradle and Gatling. I am sure a simple example project would clear this up. I have tried so many variations with sourceSets, configurations, Groovy methods and on but I cannot get this to work.
BUILD.GRADLE
plugins {
id ‘scala’
}
repositories {
jcenter()
}
configurations {
gatling
}
dependencies {
// Use Scala 2.12 in our library project
implementation ‘org.scala-lang:scala-library:2.12.9’
// Use Scalatest for testing our library
testImplementation ‘junit:junit:4.12’
testImplementation ‘org.scalatest:scalatest_2.12:3.0.8’
// Need scala-xml at test runtime
testRuntimeOnly ‘org.scala-lang.modules:scala-xml_2.12:1.2.0’
// https://mvnrepository.com/artifact/io.gatling/gatling-app
compile group: ‘io.gatling’, name: ‘gatling-app’, version: ‘3.3.1’
// https://mvnrepository.com/artifact/io.gatling/gatling-recorder
compile group: ‘io.gatling’, name: ‘gatling-recorder’, version: ‘3.3.1’
// https://mvnrepository.com/artifact/io.gatling/gatling-charts
compile group: ‘io.gatling’, name: ‘gatling-charts’, version: ‘3.3.1’
// https://mvnrepository.com/artifact/io.gatling.highcharts/gatling-highcharts
compile group: ‘io.gatling.highcharts’, name: ‘gatling-charts-highcharts’, version: ‘3.3.1’
}
task gatlingRun(type: JavaExec) {
sourceSets.test.allSource.each {println(it)}
println(“Simulations path: ${projectDir}/src/test/scala”)
description = ‘Run gatling tests’
new File("${buildDir}/reports/gatling").mkdirs()
classpath = sourceSets.test.runtimeClasspath
main = “io.gatling.app.Gatling”
args = [
‘-sf’, “${projectDir}/src/test/scala”,
‘-rf’, “${buildDir}/reports/gatling”
]
}
// ‘-s’, ‘io.monster.tests.load.simulations.feeders.JsonFeederSimulation’,