我用黄瓜设置了一个柏树解决方案,以便使用小黄瓜语法创建方案。但是我仍然有一个开放的问题。我可以像下面的图像一样生成黄瓜html报告吗? 如果是的话,那么有人可以给我一个例子,对我来说将是一个很大的收获。目前,我使用的是Mocha报告程序,但是在报告中看不到每个方案的步骤,只能看到方案名称。
答案 0 :(得分:2)
您应该生成cummon-json报告。 在package.json中设置配置:
"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文件以生成报告:
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);
运行测试并执行报告文件:
node ./support/cucumber-html-reporter.js