【问题标题】:Configuring Gradle Test tasks for Android to log events为 Android 配置 Gradle 测试任务以记录事件
【发布时间】:2015-09-24 17:27:06
【问题描述】:

当我使用 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'

【问题讨论】:

    标签: android unit-testing android-gradle-plugin build.gradle


    【解决方案1】:

    您是否尝试过使用:

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

    【讨论】:

    • 不,我已经放弃了。谢谢您的建议。我会试一试的。
    猜你喜欢
    • 1970-01-01
    • 2020-05-20
    • 2013-10-31
    • 1970-01-01
    • 1970-01-01
    • 2017-04-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多