2017-04-06 71 views
0

我正在使用量角器實施黃瓜,一切似乎都沒問題,因爲沒有失敗,但是當我執行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

這取決於您如何配置conf.js文件的運行。例如。

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

如果您有在從觸發與例如npm test從你的項目的根項目的根觸發量角器包JSON的腳本,量角器然後將從root/{config.specs}

搜索文件

如果您正在運行來自./config-文件夾的腳本,則它將從root/config/{config.specs}進行搜索。

所以它取決於你從哪裏觸發你的腳本搜索功能文件

+0

所以你的意思是我的規格路徑是錯誤的?因爲我嘗試與differents路徑實際上,如果我添加一個路徑的測試只是使用量角器工作是執行測試,但是當我添加指向黃瓜功能的路徑不會執行任何操作。 – burq24

+0

@ burq24,看[this](https://github.com/angular/protractor/blob/master/lib/config.ts#L192)。 你也可以舉一個功能文件的例子嗎? – wswebcreation

+0

當然這是我對功能'特點:用量角器 方案中運行黃瓜:量角器和黃瓜測試 的。說Hi' – burq24