我的build.gradle中有一个Gradle任务,它正在调用Gulp任务:
task runProtractorRegression(type: Exec){
executable "xvfb-run"
args "gulp", "runEndtoEnd_headless"
}
Gulp任务是:
gulp.task('runEndtoEnd_headless', ['runEndtoEnd_headless:src']);
gulp.task('runEndtoEnd_headless:src', runEndtoEnd_headless);
function runEndtoEnd_headless (done) {
var params = process.argv;
var args = params.length > 3 ? [params[3]] : [];
console.log("Parameter to Gulp task:runEndtoEnd_headless is:",args);
gulp.src(path.join(conf.paths.e2e,'./src/test/web/testScripts/Validations/*.js'))
.pipe($.protractor.protractor({
configFile: 'runEndtoEnd_headless.conf.js',
args: args
}))
}
我可以通过传递这样的参数来运行gulp任务:
gulp runEndtoEnd_headless --params.login.argument=DEV
如何将上述参数传递给Gradle任务:runProtractorRegression?
答案 0 :(得分:1)
args "gulp", "runEndtoEnd_headless", "--params.login.argument=DEV"
只需以逗号分隔的字符串为args
行添加参数。