java-tutorials/gradle-modules/gradle/gradle-cucumber/build.gradle

69 lines
1.6 KiB
Groovy

import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
id 'java'
id 'se.thinkcode.cucumber-runner' version '0.0.8'
}
ext {
junitVersion = '5.7.2'
cucumberVersion = '6.10.4'
}
group 'com.baeldung'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testImplementation "io.cucumber:cucumber-java:${cucumberVersion}"
testImplementation "io.cucumber:cucumber-junit:${cucumberVersion}"
testImplementation "org.junit.vintage:junit-vintage-engine:${junitVersion}"
}
configurations {
cucumberRuntime {
extendsFrom testImplementation
}
}
task cucumberCli() {
dependsOn assemble, testClasses
doLast {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = [
'--plugin', 'pretty',
'--plugin', 'html:target/cucumber-report.html',
'--glue', 'com.baeldung.cucumber',
'src/test/resources']
}
}
}
cucumber {
main = 'io.cucumber.core.cli.Main'
}
test {
useJUnitPlatform()
testLogging {
events TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED
}
systemProperties(project.gradle.startParameter.systemPropertiesArgs)
}