Vishal Wasekar
10/23/2023, 2:27 PMtasks.register('cucumberRerunFailed') {
onlyIf {
def rerunTxtFile = file('build/rerun.txt')
return rerunTxtFile.exists() && rerunTxtFile.text.trim() != ''
}
doLast {
try {
javaexec {
main = "io.cucumber.core.cli.Main"
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
args = ['--plugin', 'json:build/reports/cucumber-tests/cucumber-rerun-report.json',
'--glue', 'com.xyz.microservice.core.test.cucumber',
'@build/rerun.txt']
}
} catch (Exception e) {
println("cucumberRerunFailed task failed, but build will continue. Result: " + e)
}
}
}
configurations {
cucumberRuntime {
extendsFrom testImplementation
}
}
Required dependency in classpath:
testImplementation ("com.xyz:xyz-microservice-test-framework")
Thanks in Advance,
Vishal