我计划将我的testcafe控制台输出转换为具有自定义文件名的txt/html文件,我使用下面的脚本行,但输出文件没有生成,也没有错误。我已经安装了所需的报告模板。请引导我。
$testcafe chrome tests/core/sample.test.js--reporter html:/file.html$testcafe chrome tests/core/sample.test.js--报告程序列表:/test.txt
谢谢Ramesh D
控制台输出到txt
这不是更容易吗?
$ testcafe chrome tests/core/sample.test.js > test_output.txt 2>&1
我的意思是,你可以使用报告程序,你可以构建自己的报告程序并花几个小时,或者如果你真的只需要一个控制台输出的文件,这应该就足够了。
控制台输出到html
我有使用配置文件而不是命令行选项的习惯,所以我会在配置文件上显示它:
.testcaferc.json
{
"reporter": [
{
"name": "html",
"output": "Results/report.html"
}
]
}
首先,当然,您需要安装适当的npm包:
$ npm install --save-dev testcafe-reporter-html
如果您坚持使用命令行选项,这个testcafe文档应该会为您提供指导。我相信这将是正确的命令:
$ testcafe chrome tests/core/sample.test.js -r html:Results/report.html