Instrumentation测试框架:
测试集合基于JUnit,可以扩展Android JUnit来测试Android组件。
android create test-project -m .. -p tests
Activity.onResume函数,不能直接调用,通过仪表盘API可以触发并且测试。
两者方法,调用ActivityInstrumentationTestCase2.getActivity
mActivity=this.getActivity()
或者用Instrument类提供的辅助API
Instrumentation instr = this.getInstrumentation()
instr.callActivityOnResume(mActivity)
仪表盘技术需要使用意图创建待测活动,当活动有跳转
使用robotium编写集成测试用例
具体看书吧。。。这本书真的不错,推荐购买。。。
本文介绍了如何使用 Android 的 Instrumentation 测试框架进行组件级测试,包括如何触发 Activity 生命周期中的特定方法,如 onResume,并提供了使用 Instrumentation API 和 Robotium 编写集成测试的具体示例。
1092

被折叠的 条评论
为什么被折叠?



