量角器没有从黄瓜运行功能文件

时间:2017-04-06 00:43:35

标签: javascript protractor automated-tests cucumber

我正在使用量角器实施黄瓜,一切似乎都没问题,因为没有失败,但是当我执行termal时,表示执行了0个场景。

这是我的conf.js:

exports.config = {
  seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
  framework: 'custom',
  frameworkPath: require.resolve('protractor-cucumber-framework'),

  capabilities: {
    'browserName': 'firefox'
  },

  specs: './features/login.feature',

  onPrepare: function(){
    browser.driver.manage().window().maximize()
    browser.get('http:www.google.com')
  },

  jasmineNodeOpts: {
    showColors: true, // Use colors in the command line report.
  },

  cucumberOpts: {
    require: 'features/steps/my_steps.js',
  }
};

这是我的框架树:

enter image description here

但是当我执行protractor conf.js时,我在终端输出了这个输出:

[17:27:45] I/launcher - Running 1 instances of WebDriver
[17:27:45] I/hosted - Using the selenium server at    http://127.0.0.1:4444/wd/hub
0 scenarios
0 steps
0m00.000s

所以我只是想知道我在conf.js上是否有什么问题,或者我应该执行另一个命令来运行带有量角器的功能文件。

希望你能帮助我。

1 个答案:

答案 0 :(得分:1)

这取决于您如何配置conf.js文件的运行。例如。

root | |_features |_config | |_conf.js |_package.json

如果您在json包中有一个脚本从项目的根目录触发了来自项目根目录的量角器,例如npm test来自项目的根目录,则Protractor将从{{1}搜索文件}

如果您正在运行来自例如root/{config.specs} - 文件夹的脚本,那么它将从./config进行搜索。

因此,它取决于您在搜索功能文件时触发脚本的位置