javascript - Protractor - 发送规范/套件名称作为参数

标签 javascript testing command-line-arguments protractor test-suite

我可以使用规范或套件名称作为参数来运行 Protractor 测试吗? 我目前正在运行它:

protractor myconf.js 

谢谢。

最佳答案

是的,有特定的--specs命令行参数:

$ protractor --help
Usage: protractor [options] [configFile]
configFile defaults to protractor.conf.js
The [options] object will override values from the config file.
Options:
  --help                                             Print Protractor help menu                               
  --version                                          Print Protractor version         
...
  --specs                                            Comma-separated list of files to test  

您仍然需要传递配置,但是 --specs 会覆盖配置中设置的 specs:

protractor myconf.js --specs=test/e2e/myspec.js

您还可以使用 --suite command-line argument :

protractor myconf.js --suite=smoke

其中 smoke 匹配配置的套件名称:

suites: {
  smoke: 'spec/smoketests/*.js',
  full: 'spec/*.js'
},

或者,如果您使用的是 jasmine2,则可以使用 "focused tests" feature通过暂时将 describe 更改为 fdescribe 和/或将 it 更改为 fit

关于javascript - Protractor - 发送规范/套件名称作为参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31382299/

相关文章:

javascript - 如何在表单提交后保持模态窗口打开并在同一模态窗口中显示新页面

javascript - Bootstrap 导航栏下拉菜单/折叠的导航栏未打开

testing - 如何将 TestCafé 测试组织为多个步骤?

string - 如何在golang中读取 "\t"作为标签

encoding - 命令行参数作为字节而不是python3中的字符串

javascript - 测试元素是否存在 Vuejs, Karma, Mocha

JavaScript 无法在 Asp 上运行。网

javascript - Protractor/WebDriverJS 中被拒绝的 promise

ruby - 使用 Rspec 测试 Goliath + Grape

go - 如何在 Go 中获取命令参数?