-
Notifications
You must be signed in to change notification settings - Fork 10
Gradle
Peter Thomas edited this page Dec 5, 2024
·
5 revisions
A sample build.gradle
is provided below. You can also use the gradle branch of this repository.
plugins {
id 'java'
}
ext {
karateVersion = '1.5.0'
}
dependencies {
implementation "io.karatelabs:karate-core:${karateVersion}" // normally not needed, here used to run server
testImplementation "io.karatelabs:karate-junit5:${karateVersion}"
testImplementation "io.karatelabs:karate-gatling:${karateVersion}"
}
sourceSets {
test {
resources {
srcDir file('src/test/java')
exclude '**/*.java'
}
}
}
test {
useJUnitPlatform()
systemProperty "karate.options", System.properties.getProperty("karate.options")
systemProperty "karate.env", System.properties.getProperty("karate.env")
outputs.upToDateWhen { false }
}
repositories {
mavenCentral()
}
// to run, type: "gradle gatling"
tasks.register('gatlingRun', JavaExec) {
classpath = sourceSets.test.runtimeClasspath
mainClass = "io.gatling.app.Gatling"
args = [
'-s', 'app.perf.TodoSimulation',
'-rf', "${layout.buildDirectory.get().asFile}/reports/gatling"
]
systemProperties System.properties
}
To check that things work, run the included JUnit ApiTest
:
./gradlew test --tests ApiTest -i
To start the server (which brings up the sample app on http://localhost:8080):
gradle test --tests LocalRunner -i
And then to run performance tests (in another terminal):
gradle gatling