Skip to content
Peter Thomas edited this page Sep 1, 2019 · 15 revisions

Here is a simple build.gradle for Karate and JUnit 5. Please also refer to the main README.

plugins {
    id 'java'
}

ext {
    karateVersion = '1.0.0'
}

dependencies {
    testCompile "com.intuit.karate:karate-junit5:${karateVersion}"
    testCompile "com.intuit.karate:karate-apache:${karateVersion}"
}

sourceSets {
    test {
        resources {
            srcDir file('src/test/java')
            exclude '**/*.java'
        }
    }
}

test {
    useJUnitPlatform()
}

repositories {
    mavenCentral()
    // mavenLocal()
}

task karate(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'