Getting gradle to work with cucumber cleanly is something of a challenge. I want to get gradle build
to compile and run the tests, but so far I've had no success.
build.gradle
plugins {
id "com.github.samueltbrown.cucumber" version "0.9"
}
apply plugin: 'java'
apply plugin: 'idea'
def JAVA_WEBSOCKET_VERSION = '1.2.1'
def CUCUMBER_VERSION = '1.2.4'
jar {
manifest {
attributes 'Implementation-Title': 'Java-WebSocket',
'Implementation-Version': JAVA_WEBSOCKET_VERSION
}
}
repositories {
jcenter()
}
dependencies {
testCompile "info.cukes:cucumber-java:$CUCUMBER_VERSION"
testCompile "info.cukes:cucumber-junit:$CUCUMBER_VERSION"
testCompile 'junit:junit:4.+'
}
task wrapper(type: Wrapper) {
gradleVersion = '2.9'
}
Currently I get many errors about the annotations (@Given
, @Then
, @After
) that cucumber uses. What I want is to build the project cleanly without using JavaExec. Is this possible or is there a specific limitation to either gradle or cucumber that prevents this?
Please use the below gradle cucumber plugin in your build.gradle file
plugins { id 'java' id "com.github.samueltbrown.cucumber" version "0.9" }
dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' compile 'org.codehaus.groovy:groovy:2.4.7' cucumberCompile 'info.cukes:cucumber-groovy:1.2.2' }
Running gradle cucumber in the terminal will get you started
I created another function to execute test
now Call this function from command line for test execution