-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Gradle
Peter Thomas edited this page Apr 14, 2023
·
11 revisions
Here is a simple build.gradle
for Karate and JUnit 5. Please also refer to the main README. You can also find a standalone project within the Karate source code here: jobserver
.
Also see other references such as this one.
Make sure you change the karateVersion
from X.X.X
to the version you need, the latest one will be visible here.
plugins {
id 'java'
}
ext {
karateVersion = 'X.X.X'
}
dependencies {
testImplementation "com.intuit.karate:karate-junit5:${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()
// mavenLocal()
}
task karateDebug(type: JavaExec) {
classpath = sourceSets.test.runtimeClasspath
main = 'com.intuit.karate.cli.Main'
}
The optional karate
task makes it easier to connect tools such as the Visual Studio Code IDE and use the dedicated Karate extension.
For example, to start the Karate Debug Server:
gradle karate --args='-d'
It is possible to use the Karate Gatling integration with Karate by using a custom JavaExec
task as shown above. Refer to the documentation here.