【发布时间】:2020-03-09 06:04:43
【问题描述】:
我正在寻找空手道自动化的示例/示例 gradle 项目。在空手道演示中尝试过,但没有帮助。 简单的骨架也有帮助
【问题讨论】:
标签: testing automation karate
我正在寻找空手道自动化的示例/示例 gradle 项目。在空手道演示中尝试过,但没有帮助。 简单的骨架也有帮助
【问题讨论】:
标签: testing automation karate
请参考此维基页面:https://github.com/intuit/karate/wiki/Gradle
plugins { id 'java' } ext { karateVersion = '0.9.5.RC4' } 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() systemProperty "karate.options", System.properties.getProperty("karate.options") systemProperty "karate.env", System.properties.getProperty("karate.env") outputs.upToDateWhen { false } } repositories { mavenCentral() }
【讨论】:
我使用 VSCode,但话虽如此,这是我的通用空手道测试器项目 build.gradle:
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.gradle.api.tasks.testing.TestResult
import org.gradle.api.tasks.testing.TestResult.ResultType
plugins {
id "java"
}
sourceCompatibility = 11
targetCompatibility = 11
repositories {
mavenCentral()
}
dependencies {
def karateVersion = "0.9.6"
testImplementation "com.intuit.karate:karate-junit5:$karateVersion"
testImplementation "com.intuit.karate:karate-apache:$karateVersion"
}
sourceSets {
test {
resources {
srcDir file("src/test/java")
exclude "**/*.java"
}
}
}
test {
testLogging {
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
showCauses true
showExceptions true
showStackTraces true
outputs.upToDateWhen {false}
showStandardStreams true
}
useJUnitPlatform()
systemProperty "karate.options", System.properties.getProperty("karate.options")
systemProperty "karate.env", System.properties.getProperty("karate.env")
}
task karateExecute(type: JavaExec) {
classpath = sourceSets.test.runtimeClasspath
main = "com.intuit.karate.cli.Main"
}
【讨论】: