赛普拉斯使用摩卡多报告进行测试; 无法获得所有测试规范的汇总结果

kap*_*kat 5 mocha.js test-results cypress

使用mocha多报告的赛普拉斯测试未显示所有测试的结果

我的测试结构看起来像这样:
柏树
 集成
  模块1
   module1test1_spec.js
   module1test1_spec.js
  模块2
   module2test1_spec.js
   module2test1_spec.js

我已经设置赛普拉斯使用mocha-multi-reports,就像在
https://docs.cypress.io/guides/tooling/reporters.html#Multiple-Reporters下提供的说明一样,
我的config.json看起来就像这里:
https:/ /github.com/cypress-io/cypress-example-docker-circle#spec--xml-reports
当赛普拉斯完成测试,results.xml文件是从最后一次测试规范结果ONLY ; module2test1_spec.js
如何配置它以获取所有测试规范的聚合结果?

Bur*_*han 5

您可以在路径中使用 [hash].xml。

例如./path_to_your/test-results.[hash].xml。[hash] 替换为测试结果 XML 的 MD5 哈希值。这使得支持并行执行多个 mocha-junit-reporter 将测试结果写入单独的文件中。

https://www.npmjs.com/package/mocha-junit-reporter#results-report

我用这种方法解决了这个问题。

我的 config.json 文件看起来像这样:

"reporterEnabled": "spec,json, mocha-junit-reporter",
  "mochaJunitReporterReporterOptions": {
    "mochaFile": "multiple-results/[hash].xml",
Run Code Online (Sandbox Code Playgroud)