【问题标题】:Protractor is not running features file from cucumber量角器没有从黄瓜运行功能文件
【发布时间】:2017-04-06 12:32:56
【问题描述】:

我正在用量角器执行黄瓜,一切似乎都很好,因为没有失败,但是当我执行 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',
  }
};

这是我的框架树:

但是当我执行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 是否有问题,或者我应该执行另一个命令来使用量角器运行功能文件。

希望你能帮助我。

【问题讨论】:

    标签: javascript protractor automated-tests cucumber


    【解决方案1】:

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

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

    如果您在包 json 中有一个脚本从项目的根目录触发量角器,例如由项目根目录的 npm test 触发,那么量角器将搜索来自 root/{config.specs} 的文件

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

    所以这取决于您在搜索功能文件时触发脚本的位置

    【讨论】:

    • 所以你的意思是我的规格路径是错误的?因为我尝试了不同的路径实际上如果我添加一个路径到测试只是使用量角器正在执行测试但是当我添加指向黄瓜特征的路径时没有执行任何操作。
    • @burq24,见this。你能举个特征文件的例子吗?
    • 这就是我的功能Feature: Running Cucumber with Protractor Scenario: Protractor and Cucumber Test Given Say Hi
    • 还有我的步骤文件:module.exports = function(){ this.Given(/Say Hi/, function () { console.log('Hi'); }); }
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-04
    相关资源
    最近更新 更多