如何使用一个参数来量角器配置文件选择步骤? [英] How can I use a parameter to a protractor configuration file to chose steps?
问题描述
继<一个领先href=\"http://stackoverflow.com/questions/29406962/can-i-access-parameters-in-my-protractor-configuration-file\">this问题,我试过(naievely)要做到这一点:
量角器测试/功能/量角器-conf.js --params.test_set = dev_test
和
量角器-conf.js:
exports.config = {
// ...
规格:[browser.params.test_set +'/ *功能'],
...但当然,因为浏览器是不是在那个conf文件是解析时定义这是行不通的。
所以,我怎么能实现这样的效果:将参数传递到量角器确定的规格
使用 - 规格
命令行参数:
- 规格
文件,以测试的逗号分隔列表
块引用>量角器测试/功能/量角器-conf.js --specs = dev_test / *功能
注意
dev_test / *功能
将传递到量角器的命令行界面,将根据当前的工作目录(的来源$ C $ C )。Following the lead of this question, I tried (naievely) to do this:
protractor test/features/protractor-conf.js --params.test_set=dev_test
and
protractor-conf.js:
exports.config = { // ... specs: [browser.params.test_set+'/*.feature'],
... but of course it doesn't work because browser is not defined at the time that the conf file is parse.
So how could I achieve this effect: passing a parameter to protractor that determines the specs?
解决方案Use the
--specs
command-line argument:
--specs
Comma-separated list of files to test
protractor test/features/protractor-conf.js --specs=dev_test/*.feature
Note that
dev_test/*.feature
would be passed into the protractor's command-line-interface which would resolve the paths based on the current working directory (source code).这篇关于如何使用一个参数来量角器配置文件选择步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!