gpt4 book ai didi

Android Junit4 测试未出现在 CircleCI 测试摘要中

转载 作者:行者123 更新时间:2023-11-29 22:59:16 24 4
gpt4 key购买 nike

我有一个在 CircleCI 上运行的 Android 项目。测试成功运行,我可以在我的 config.yml 文件中上传这样的内容:

  - store_artifacts:
path: module1/build/reports/tests/testDebugUnitTest/
destination: test-results/module1
- store_artifacts:
path: module2/build/reports/tests/testDebugUnitTest/
destination: test-results/module2
- store_test_results:
path: test-results

这些已成功上传到 CircleCI 上的“Artifact ”选项卡。在 Artifacts 选项卡中,我可以打开每个模块并单击每个单独模块的测试报告。我得到了一个很好的 Index.html 文件,其中显示了该模块的摘要。

但是我无法使测试摘要生效。无论我如何更改文件夹结构,它都只会显示“设置测试摘要”。

这是有问题的,因为如果测试失败,我必须单独打开每个模块并查看这些报告,而不是获得完整的摘要。

是否像我这样由 Gradle 5.2.1 生成的 Android 测试报告不受 CircleCI 支持,还是我做错了什么?

最佳答案

原来问题是 Android/Kotlin 不一定默认生成 XML 报告。

解决方案是将以下内容放入每个模块的 build.gradle 文件中:

android {

testOptions {
unitTests.all {
reports {
junitXml.enabled = true
junitXml.destination = file("$buildDir/../../build/test-results/moduleName")
}
}
}
}

然后将 config.yml 文件的路径更新为:

  - store_artifacts:
path: build/test-results
destination: test-results
- store_test_results:
path: build/test-results

关于Android Junit4 测试未出现在 CircleCI 测试摘要中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57110381/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com