我想创建黄瓜 html 报告,我是 Node JS 的新手,我尝试搜索它,我使用了以下
this.registerHandler('AfterFeatures', function(callback) {
try {
var options = {
theme: "bootstrap",
jsonFile: "/report/cucumber.json",
output: "/report/cucumber_report.html",
reportSuiteAsScenarios: true,
launchReport: true,
metadata: {
"App Version": "0.0.1"
}
};
reporter.generate(options);
} catch (e) {
console.log(e);
}
callback();
});
但是当我运行我的代码时,黄瓜功能场景被执行,它最终给了我一个错误说明,
Unable to parse cucumberjs output into json: '/report/cucumber.json' { Error: /report/cucumber.json: ENOENT: no such file or directory, open '/report/cucumber.json'
at Object.fs.openSync (fs.js:652:18)
at Object.fs.readFileSync (fs.js:553:33)
at Object.readFileSync (/Users/sarav/Documents/GitHub/automationtests/node_modules/jsonfile/index.js:67:22)
at isValidJsonFile (/Users/sarav/Documents/GitHub/automationtests/node_modules/cucumber-html-reporter/lib/reporter.js:404:48)
at Object.generate (/Users/sarav/Documents/GitHub/automationtests/node_modules/cucumber-html-reporter/lib/reporter.js:426:9)
at Object.generateReport [as generate] (/Users/sarav/Documents/GitHub/automationtests/node_modules/cucumber-html-reporter/index.js:30:21)
at /Users/sarav/Documents/GitHub/automationtests/features/support/hooks.js:49:22
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/report/cucumber.json' }
上述代码是否会自动生成 .json 和 .html 文件,或者我们需要手动创建一个 .json 文件并将其转换为 html 报告。
我研究过 Java,它会在执行结束时自动创建 json 和 html 报告。
由于这是非常新的,我无法弄清楚缺少的部分是什么
谢谢