Android 测试 - 如何添加 Espresso 日志

标签 android continuous-integration android-espresso

我在用

androidTestCompile 'com.android.support.test:runner:0.3'
    androidTestCompile 'com.android.support.test:rules:0.3'
    androidTestCompile 'com.android.support:support-annotations:23.0.1'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
    androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2') {
        // this library uses the newest app compat v22 but the espresso contrib still v21.
        // you have to specifically exclude the older versions of the contrib library or
        // there will be some conflicts
        exclude group: 'com.android.support', module: 'appcompat'
        exclude group: 'com.android.support', module: 'support-v4'
        exclude module: 'recyclerview-v7'
    }
    androidTestCompile 'junit:junit:4.12'

用于测试,想知道是否有办法让 espresso 打印包含开始测试和完成测试的日志,以便在发生某些事情时很容易看到 logcat。

与 papertrail 结合使用以检查测试失败的原因以及使用私有(private)集成服务器的位置会很棒。

最佳答案

您可以通过 Spoon 在 CI 服务器上运行测试来捕获 Android 日志.在他们的网站上查看操作示例,并查看下面的链接以获取示例报告,然后查看其中一项测试的日志。每次测试运行都会捕获日志并保存在报告中。

报告输出:http://square.github.io/spoon/sample/index.html

示例日志:http://square.github.io/spoon/sample/logs/0403681E12013007/com.example.spoon.ordering.tests.OrderActivityTest/testMakeASandwich_ItTastesGood.html

关于Android 测试 - 如何添加 Espresso 日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32506290/

相关文章:

android - 空闲资源在 Android 的第二个 Activity 中不起作用

android - espresso - 如何为自定义测试运行程序声明路径

android - 在Android中在ViewPager中单击按钮时播放音频有效

android - wifi 和 3G 可以在 Android 上同时工作吗?

docker - 容器化(Docker)会取代持续集成吗?

docker - 亚马逊ECS上的容器运输

continuous-integration - jenkins 中的几个 checkstyle 报告

android - 如何开发像谷歌日历这样的带有粘性列的 ListView

android - 如何使用 SearchView 过滤 RecyclerView

java - Android Espresso - 关闭 SearchView