我可以在cypress中生成cucumbur html报告吗? [英] Can I generate cucumbur html report in cypress?
问题描述
我使用黄瓜设置了柏树解决方案,以便使用小黄瓜语法创建方案。但是我仍然有一个开放的问题。我可以像下面的图像一样生成黄瓜html报告吗?
如果是的话,如果有人可以给我一个例子,这对我来说就太好了。目前,我使用的是Mocha报告程序,但无法在报告中看到每个方案的步骤,只能看到方案名称。
I set up a cypress solution with cucumber in order to use gherkin syntax to create my scenarios. But I still have an open question. Can I generate a cucumber html report like in the image bellow? If yes, it would be great full for me if somebody can provide me an example. At the moment I use mocha reporter, but I can't see the steps for each scenario into the report, only the scenario name.
这是使用摩卡报告程序的实际报告:=>
This is the actual report using mocha reporter: =>
推荐答案
您应该生成cummon-json报告。
在您的package.json集配置中:
You should generate cucumber-json report. In your package.json set configuration :
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": false,
"stepDefinitions": "cypress/stepDefinitions",
"cucumberJson": {
"generate": true,
"outputFolder": "cypress/cucumber-json",
"filePrefix": "",
"fileSuffix": ".cucumber"
}
}
npm install cucumber-html-reporter --save-dev
并创建js文件以生成reporte:
and create js file to generate reporte :
const reporter = require('cucumber-html-reporter');
const options = {
theme: 'hierarchy',
jsonDir: 'cypress/cucumber-json',
output: 'reports/html_simple/cucumber_report.html',
reportSuiteAsScenarios: true,
scenarioTimestamp: true,
launchReport: true,
ignoreBadJsonFile: true,
scenarioTimestamp: true,
metadata: {
"App Version": "1.0.0",
"Test Environment": "STAGING",
"Browser": "Chrome 54.0.2840.98",
"Platform": "Windows 10",
"Parallel": "Scenarios",
"Executed": "Remote"
}
};
reporter.generate(options);
运行测试并执行报告文件:
Run your tests and execute reporter file :
node ./support/cucumber-html-reporter.js
这篇关于我可以在cypress中生成cucumbur html报告吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!