【发布时间】:2013-09-12 06:12:28
【问题描述】:
我有我的 uiautomator 测试用例:
public class clickTest extends UiAutomatorTestCase {
public void myTest() throws UiObjectNotFoundException {
...
//Is it possible to get Context or Activity here?
}
}
我想知道,是否有可能在 UiAutomatorTestCase 中获得 Context 或 Activity 实例?
或者如何在UiAutomatorTestCase 中获取PackageManager?
【问题讨论】:
-
您当然无法访问
Activity,因为它在单独的进程中运行。我不知道你也可以得到Context,更不用说PackageManager了。 -
谢谢,我也是这么想的,我发布这个问题只是为了确保:),我想访问上下文的原因是我想在我的测试中使用 PackageManager。让我们看看他们的其他人是否对此了解更多
-
你会声明并实例化clickText吗?
标签: android performance android-intent android-uiautomator