SETTING UP CLASSPATH VALUE IN BUILD.GRADLE

Answered

Hi All,

 

To run cucumber test we have to use below code snippet in build.Gradle file.

Reference: http://docs.cucumber.io/tools/java/#gradle

 

task cucumber() {
dependsOn assemble, compileTestJava
doLast {
javaexec {
main = "cucumber.api.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'pretty', '--glue', 'gradle.cucumber', 'src/test/resources']
}
}
}

 

My question is how to set Classpath values:. 

1. configurations.cucumberRuntime
2. sourceSets.main.output
3. sourceSets.test.output

 

How and where i need to define all the properties.

 

0
4 comments
Avatar
Yaroslav Bedrov

Hello,
You don't need to define them. They are taken automatically from project configuration.

0
Avatar
Permanently deleted user

I used to get error related to 

configurations.cucumberRuntime

So, i added below line of code to fix it.

 

configurations {
cucumberRuntime {
extendsFrom testRuntime
}
}

Can you please verify is it correct?
0
Avatar
Yaroslav Bedrov

Sorry, missed that cucumberRuntime should be configured manually.

Yes, your configuration is correct.

1
Avatar
Permanently deleted user
0

Please sign in to leave a comment.