【发布时间】:2016-08-23 05:14:10
【问题描述】:
正如其他线程中所解释的,Gradle 可以配置为将测试结果记录到控制台中:
- Gradle Android: How to Display test results without using --info
- Gradle: How to Display Test Results in the Console in Real Time?
- Output unit testing results on console using spock junit testing and gradle build system
基本上,这可以通过以下任务进行设置:
tasks.withType(Test) {
testLogging {
// Custom configuration
}
}
这适用于单元测试,看起来有点像这样:
...
:app:assembleDebugUnitTest
:app:testDebugUnitTest
:app:processDebugResources
com.example.StringsTest > formatValue PASSED
com.example.StringsTest > formatValueWithDecimals FAILED
1 test completed, 1 failed
此外,单元测试我还使用以下命令运行集成测试:
$ ./gradlew connectedAndroidTest
当我在控制台中查看输出时,我缺少单个测试结果,因为它是为单元测试编写的。如何为检测测试配置测试日志记录?
【问题讨论】:
-
这个JJD好运吗?
-
还没有。老实说,我不得不将这些测试推迟一段时间。一旦事情“恢复正常”,我就会把它捡起来。您尝试过 hidro 的方法吗?
-
不,我只是想要一个基于 Gradle 的方法。我希望像
tasks.withTest这样的东西。
标签: android gradle integration-testing android-testing