Skip to content

Instantly share code, notes, and snippets.

@judoole
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save judoole/2eb9d9c740e6e1b43645 to your computer and use it in GitHub Desktop.

Select an option

Save judoole/2eb9d9c740e6e1b43645 to your computer and use it in GitHub Desktop.
Scala Cucumber does not support dependency injection. https://github.com/cucumber/cucumber-jvm/issues/469 A workaround is to use Java or Groovy. This setup worked for me.
dependencies {
testCompile "junit:junit-dep:4.11"
testCompile "info.cukes:cucumber-scala_2.10:1.2.2"//TODO: Can be deleted?
testCompile "info.cukes:cucumber-core:1.2.2"
testCompile 'info.cukes:cucumber-java:1.2.2'
testCompile "info.cukes:cucumber-junit:1.2.2" //TODO: Not needed?
//If you'd like some dependencies
testCompile 'info.cukes:cucumber-spring:1.2.2'
testCompile 'org.springframework:spring-test:4.0.5.RELEASE'
//These are som weird-weird dependencies Cucumber+Java+Scala gets.
testCompile "xmlpull:xmlpull:1.1.3.4a"
testCompile "woodstox:wstx-asl:3.2.7"
testCompile "stax:stax:1.2.0"
testCompile "xom:xom:1.2.5"
testCompile "jdom:jdom:1.0"
testCompile "cglib:cglib:3.1"
}
configurations {
cucumberRuntime {
extendsFrom testRuntime
}
}
task cucumber(group:'Verification', description: 'Runs Cucumber tests') {
dependsOn testClasses
doLast {
//Usage.txt: https://github.com/cucumber/cucumber-jvm/blob/master/core/src/main/resources/cucumber/api/cli/USAGE.txt
javaexec {
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', project.cucumberFormat, '--glue', 'cucumber', 'src/test/resources', '--tags', '~@ignore']
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment