写的Andr​​oid UI的Automator输出控制台 [英] Writing to Android UI Automator output console

查看:323
本文介绍了写的Andr​​oid UI的Automator输出控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了Android的UI Automator的小包装。通常情况下,我们可以看到在控制台测试用例状态。我可以访问它,并添加自己的信息?我曾尝试的System.out.println 。但它没有工作。
是否有这样做的方法吗?

I am writing a small wrapper over Android UI Automator. Normally we can see the test case status in the console. Can I access it and add my own messages? I have tried System.out.println. But it did not work. Is there any way of doing this?

推荐答案

如果运行的亚行测试时,preferable方式打印到logcat的:

If running test from adb, the preferable way is printing to logcat:

import android.util.Log;

Log.d("My tag", "My log message");

在另一方面,UIAutomator的最后版本中测试类用于实现InstrumentationTestCase。这个类是junit.framework.Assert远祖先( http://developer.android .COM /参考/ JUnit的/框架/ Assert.html )。我想你会发现有用从它的方法的东西。可能是格式的方法是你要搜索的内容。

On the other hand, last version of UIAutomator is used in test class implementing InstrumentationTestCase. This class is far ancestor of junit.framework.Assert (http://developer.android.com/reference/junit/framework/Assert.html). I assume you will find something useful from its methods. May be format method is what you are searching for.

这篇关于写的Andr​​oid UI的Automator输出控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆