Cucumber 我可以在cypress中生成cucumbur html报告吗?
我用cucumber设置了一个cypress解决方案,以便使用gherkin语法创建场景。但我还有一个悬而未决的问题。我可以像下面的图片一样生成一个cucumber html报告吗? 如果是的话,如果有人能给我举个例子,那对我来说就太好了。目前我使用的是mocha reporter,但我无法在报告中看到每个场景的步骤,只能看到场景名称 这是使用mocha reporter的实际报告:=>Cucumber 我可以在cypress中生成cucumbur html报告吗?,cucumber,ui-automation,cypress,Cucumber,Ui Automation,Cypress,我用cucumber设置了一个cypress解决方案,以便使用gherkin语法创建场景。但我还有一个悬而未决的问题。我可以像下面的图片一样生成一个cucumber html报告吗? 如果是的话,如果有人能给我举个例子,那对我来说就太好了。目前我使用的是mocha reporter,但我无法在报告中看到每个场景的步骤,只能看到场景名称 这是使用mocha reporter的实际报告:=> 您应该生成报告。 在package.json集配置中: "cypress-cucumber-preproc
您应该生成报告。 在package.json集配置中:
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": false,
"stepDefinitions": "cypress/stepDefinitions",
"cucumberJson": {
"generate": true,
"outputFolder": "cypress/cucumber-json",
"filePrefix": "",
"fileSuffix": ".cucumber"
}
}
使用
并创建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
您应该生成报告。 在package.json集配置中:
"cypress-cucumber-preprocessor": {
"nonGlobalStepDefinitions": false,
"stepDefinitions": "cypress/stepDefinitions",
"cucumberJson": {
"generate": true,
"outputFolder": "cypress/cucumber-json",
"filePrefix": "",
"fileSuffix": ".cucumber"
}
}
使用
并创建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
嗨,弗兰克·卢梭,谢谢你的回答,非常有用。现在我成功地生成了Cumber json,但是当我执行我的reporter文件时仍然有一个问题。我已经准备好了。非常感谢。目前,我正在为一个场景的失败步骤附加屏幕截图。非常感谢FranckHi Sebastian,在失败的步骤上附加屏幕截图,我使用了这个[fix][1]并为我进行了改编。特别是screenshotsDir变量,因为我的功能使用子文件夹。[1] :嗨,弗兰克,非常感谢。@Sebastian嗨,你知道如何附加测试步骤失败的截图了吗?嗨,弗兰克·卢梭,谢谢你的回答。现在我成功地生成了Cumber json,但是当我执行我的reporter文件时仍然有一个问题。我已经准备好了。非常感谢。目前,我正在为一个场景的失败步骤附加屏幕截图。非常感谢FranckHi Sebastian,在失败的步骤上附加屏幕截图,我使用了这个[fix][1]并为我进行了改编。特别是screenshotsDir变量,因为我的功能使用子文件夹。[1] :嗨,弗兰克,非常感谢。@Sebastian嗨,你知道如何在测试步骤失败的情况下附加屏幕截图了吗?