Skip to content

Instantly share code, notes, and snippets.

@thomo
Created March 20, 2020 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomo/3198d2bce6bf9cbec285027ecf21e39d to your computer and use it in GitHub Desktop.
Save thomo/3198d2bce6bf9cbec285027ecf21e39d to your computer and use it in GitHub Desktop.
Run cucumber with gradle with tags support
plugins {
id 'java'
}
repositories {
jcenter()
mavenLocal()
}
def cucumberVersion = '5.5.0'
dependencies {
testImplementation "io.cucumber:cucumber-java:${cucumberVersion}"
}
configurations {
cucumberRuntime {
extendsFrom testImplementation
}
}
def tags = (findProperty('tags') == null) ? 'not @Ignore' : findProperty('tags') + ' and not @Ignore'
task cucumber() {
dependsOn assemble, compileTestJava
doLast {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = [
'--strict',
'--plugin', 'html:build/cucumber-report',
'--plugin', 'json:build/cucumber-report/cucumber.json',
'--plugin', 'pretty',
'--plugin', 'usage:cucumber-usage.json',
'--glue', 'hellocucumber',
'--tags', "${tags}",
'features',
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment