2017-04-24 74 views
0

我使用一飲而盡,黑猩猩如何HTML報表添加到黃瓜/黑猩猩端對端測試

gulp.task('chimp-options',() => { 
    return chimp({ 
     features: './features', 
     browser: 'phantomjs', 
     singleRun: true, 
     debug: false, 
     output: { 
      screenshotsPath: './screenshots', 
      jsonOutput: './cucumber.json', 
     }, 
     htmlReport: { 
      enable: true, 
      jsonFile: './e2e_output/cucumber.json', 
      output: './e2e_output/report/cucumber.html', 
      reportSuiteAsScenarios: true, 
      launchReport: true, 
     } 
    }); 
}); 

的問題,我已經和它的殺了我提供的黑猩猩網站上的例子是,當我運行一飲而盡黑猩猩的選項,我得到:

Unable to parse cucumberjs output into json: './e2e_output/cucumber.json' SyntaxError: ./e2e_output/cucumber.json: Unexpected end of JSON input 

What am I doing wrong ? 

回答

1

我相信,黑猩猩是剛剛在多個框架/庫外面的包裝,我敢肯定,他們只是用cucumber-html-reporter生成它的HTML報告。

如果你仍然無法通過黑猩猩自動工作,只需像往常一樣生成選項文件,然後使用它來生成相同的報告。

創建一個名爲generate_html_report.js的單獨文件並粘貼到用法下的代碼中。然後將其添加到您的npm腳本中,以便在測試套件完成後運行。我會避免把它放在你的afterHooks中,因爲我以前遇到過JSON文件在它試圖運行期望JSON文件在那裏的腳本之前還沒有完全生成的問題。