I have my own RunCukerTest class that extends AbstractTestNGCucumberTests, I do not know how to specify in the javaexec task of the gradle script to use it.
I have something like this, but I want to use my class instead of the cucumber CLI
you can use the Test task for testng instead of using javaexec and the RunCukerTest class that extends AbstractTestNGCucumberTests will be included in the execution.
Please take a look at this example.
task executeFeatures(type: Test) {
// enable TestNG support (default is JUnit)
useTestNG()
options {
useDefaultListeners = false
// listeners << ''
jvmArgs = ['-Dcucumber.options= ' +
'--glue org.company.app ' +
'--plugin pretty ' +
'--plugin json:build/cucumber/cucumber.json ' +
'--plugin rerun:build/cucumber/rerun.txt ' +
splitFeatureFolders(featureFolders) + ' ' +
cucumberOptions]
}
// show standard out and standard error of the test JVM(s) on the console
testLogging.showStandardStreams = true
// set JVM arguments for the test JVM(s)
scanForTestClasses = false
// ignoreFailures = true
//turn off Gradle's HTML report to avoid replacing the reports generated by TestNG library:
reports.html.enabled = false
doLast {
generateReport('build/cucumber/cucumber.json', 'build/cucumber/reports')
}
}