gpt4 book ai didi

android - 为 Android 配置 Gradle 测试任务以记录事件

转载 作者:行者123 更新时间:2023-11-29 14:14:03 26 4
gpt4 key购买 nike

当我使用 Gradle 在命令行上执行 Android 测试时,我想查看测试日志输出。我遵循了 this post 中的建议但没有记录事件。

我的应用程序/build.gradle:

apply plugin: 'com.android.application'

...

//Test Logging
tasks.withType(Test) {
testLogging {
events "started", "passed", "skipped", "failed"
}
}

我的项目有多种产品风格(免费、付费)和构建类型(调试、发布)。我预计这会为测试日志配置这些任务:

connectedAndroidTestPaidDebug
connectedAndroidTestFreeDebug
connectedAndroidTestPaidRelease
...

在 Android Studio 中,我看到警告:

Cannot resolve symbol 'testLogging'
Cannot resolve symbol 'events'

最佳答案

你有没有试过使用:

testOptions.unitTests.all {
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
}
}

关于android - 为 Android 配置 Gradle 测试任务以记录事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32767443/

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