【问题标题】:Protractor suite option won't run any test量角器套件选项不会运行任何测试
【发布时间】:2015-08-14 20:58:27
【问题描述】:

我在某处读到量角器可以在其配置文件中指定套件选项,我使用了类似的东西

suites: {
homepage: 'test/e2e/homepage/*.js'
},

然后我运行套件:

protractor protractor.conf.js --suite homepage

protractor protractor.conf.js --suite=homepage

但两者都没有进行任何测试,并说: 0 次测试,0 次断言,0 次失败

非常感谢任何建议

【问题讨论】:

  • 如果你的量角器使用--specs='test/e2e/homepage/*.js' 是否有效?
  • 如果我使用 --specs=test/e2e/homepage/*.js (在你的例子中没有'')它会工作
  • 如果我在配置文件中使用 specs:[...] 它也会运行,但重点是在配置文件中使用套件选项,这对我不起作用
  • 我会尝试添加[] 看看是否有帮助:homepage: ['test/e2e/homepage/*.js'] 和其他的东西会添加绝对路径。此外,如果您可以将要点链接到完整的配置文件,那么这里可能会发生其他事情。
  • 我已更新到最新版本,现在 --suite 正在运行。非常感谢您的帮助!

标签: protractor


【解决方案1】:

确保路径 suite 相对于 protractor.conf 文件。以这样的目录结构为例:

├── app
│   └── test1.e2e.js
│   └── test2.e2e.js
├── test
│   └── protractor-conf.js

您的protractor.conf 应如下所示:

suites: {
  mySuite: [

    // The suite path is relative to the protractor.conf file
    '../app/*.e2e.js'
  ],
},

这与spec 不同,后者使用相对于运行量角器的 CWD 的路径:

// Assuming you run tests from parent dir of `app`
specs: [
  'app/test1.e2e.js'
  'app/test2.e2e.js'
],

【讨论】:

    猜你喜欢
    • 2018-06-18
    • 2019-07-19
    • 1970-01-01
    • 1970-01-01
    • 2020-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多