当前位置:文档之家› Android 自动化测试之 Instrument深入研究(3)

Android 自动化测试之 Instrument深入研究(3)

Android、JUnit深入浅出
关键词:
在学习Android、JUnit的过程中,随着学习的深入,将Android、JUnit的类按照继承关系整理如下:
Test—TestCase—AndroidTestCase
Test—TestCase—InstrumentationTestCase
Test—TestSuite—InstrumentationTestSuite
TestListener——BaseTestRunner—AndroidTestRunner
Instrumentation—InstrumentationTestRunner
上面的5条路线,也是我们不断学习的过程,对于前4条路线感觉自己解析的都比较清楚,最后一条路线似乎说的不是很清楚,后来我又查看了不少这方面的资料,对Instrumentation再次说明下。

每个Android 应用程序运行在自己的进程,Instrumentation杀死当前应用程序,并重新启动应用程序(restarts the process with Instrumentation)。

Instrumentation提供给我们一个应用程序上下文的Handle,通过这个Handle我们可以洞察应用程序,从而验证测试断言,我们还可以通过它来写一些比界面测试更加底层的测试用例。

需要强调说明的是:Instrumentation不能捕获UI方面的 bugs。

Android在JUnit的基础上扩展出来的、与Instrumentation有关的3个类:。

相关主题