2016-10-04 46 views
2

這可能聽起來重複,但事實並非如此。與綜合報告並行運行量角器黃瓜

我知道我可以在配置文件中使用下面的配置,並啓動多個並行運行共享步驟定義的功能的chrome驅動程序實例。

capabilities: { 
    'browserName': 'chrome',  
    'shardTestFiles': true, 
    'maxInstances': 0 
    }, 

Q1。但我的問題是爲什麼當場景失敗時,chromedriver不會退出?(只有當我使用maxInstance> 0的值時纔會發生這種情況)。 帶出口代碼-3和出口代碼-1的chromedriver出口。

Q2。有人能夠理清報告問題嗎?如何在所有功能完成後生成報告?

任何形式的幫助將不勝感激?

感謝

+0

'量角器,黃瓜framework' [似乎不支持](https://github.com/protractor-cucumber-framework/protractor-cucumber-framework/pull/25 )在分片模式下運行時報告。爲了解決這個問題,用具有這個功能的'serenity-js'替換'protractor-cucumber-framework'。更多信息在[這個答案](http://stackoverflow.com/questions/34821016/is-there-a-protractor-reporting-tool-that-works-with-a-cucumber-framework/42598696#42598696)。 –

回答

0

現有行爲correct.Do不使用'maxInstances': 0 的默認值是1,任何value>1是做正確的方式。您看到這個錯誤是因爲這就是源代碼如何 - taskScheduler

他們正在處理這個taskScheduler出口碎片測試和maxinstances邏輯如下

this.maxInstance = capabilities.maxInstances || 1; 
/** 
* Get maximum number of concurrent tasks required/permitted. 
* 
* @return {number} 
*/ 
count += Math.min(queue.maxInstance, queue.specLists.length); 

所以,如果你有maxInstances 0,它會導致問題,你的代碼將永遠不會完全退出。此外,我不認爲你的代碼將在並行

運行我的建議是

  1. 檢查量角器版本和更新到最新的

  2. 更改您的配置文件來 - 'maxInstances': 3 //什麼更大1.默認爲

+0

似乎沒有本地支持黃瓜後量角器版本2.5。它支持定製框架,而黃瓜框架必須是「量角器 - 黃瓜框架」。我確實改變了'maxInstances'= 1。但是我回到了原點。當場景失敗時,有沒有一個原因讓chromedriver退出? – Galileo123

1

爲了在並行運行後生成合並的html報告,我使用了afterLaunch p protractor.conf.js文件中的參數,並使用https://github.com/gkushang/cucumber-html-reporter。下面是代碼 -

afterLaunch: function afterLaunch() { 
    var cucumberHtmlReporter = require('cucumber-html-reporter'); 
    var jsonReportFolder = '/path/to/all/json/reports'; 
    var cucumberhtmlReport = path.join(jsonReportFolder, cucumber.html'); 
    var options = { 
     theme: 'bootstrap', 
     jsonDir: jsonReportFolder, 
     output: cucumberhtmlReport, 
     reportSuiteAsScenarios: true, 
     launchReport: true 
    }; 

    cucumberHtmlReporter.generate(options); 

}