您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 市场营销 > robotium学习笔记
目录 简介 .................................................................................................................................................. 1 Robotium provides the following benefits: ............................................................................... 2 Instrumentation机制 ............................................................................................................... 2 Robotium的缺点 ...................................................................................................................... 3 局限性 ............................................................................................................................... 3 关于RemoteControl ......................................................................................................... 4 NativeDriver vs. Robotium ........................................................................................................ 4 TMTS vs .Robotium vs. Android Native Driver .......................................................................... 5 其它工具 ................................................................................................................................... 6 Robotium自动化测试开发环境搭建 .............................................................................................. 6 基本使用方法 ................................................................................................................................... 6 例1 – HelloWorld ..................................................................................................................... 6 例2 – 官方例子 ..................................................................................................................... 10 java.lang.NoClassDefFoundError: com.jayway.android.robotium.solo.Solo错误解决 .......... 13 例3 – 测试米聊 ..................................................................................................................... 13 多个activity的测试 ............................................................................................................... 18 测试执行......................................................................................................................................... 21 对象识别......................................................................................................................................... 22 API ................................................................................................................................................... 22 无源码APK测试方法 .................................................................................................................... 22 关于apk签名 ......................................................................................................................... 24 框架设计......................................................................................................................................... 33 测试用例管理 ......................................................................................................................... 35 Robotium数据驱动测试框架 ............................................................................................ 37 FAQ .................................................................................................................................................. 38 Tips .................................................................................................................................................. 39 简介 Robotiumisatestframeworkcreatedtomakeiteasytowritepowerfulandrobustautomaticblack-boxtestcasesforAndroidapplications.WiththesupportofRobotium,testcasedeveloperscanwritefunction,systemandacceptancetestscenarios,spanningmultipleAndroidactivities.RobotiumhasfullsupportforActivities,Dialogs,Toasts,MenusandContextMenus. Robotium provides the following benefits: •Youcandeveloppowerfultestcases,withminimalknowledgeoftheapplicationundertest.•TheframeworkhandlesmultipleAndroidactivitiesautomatically.•Minimaltimeneededtowritesolidtestcases.•Readabilityoftestcasesisgreatlyimproved,comparedtostandardinstrumentationtests.•Testcasesaremorerobustduetotherun-timebindingtoGUIcomponents.•Blazingfasttestcaseexecution.•IntegratessmoothlywithMavenorAnttoruntestsaspartofcontinuousintegration. Instrumentation机制 刚好前段时间也研究了一下Android的自动化测试框架。感觉用起来还是比较方便的。 几点体会也一起和大家交流下,有一些内容还在慢慢学习中: 1.Java5(2004‐10)开始推出了Instrumentation,这是一个可以在main之前Java虚拟机加载类时改变Java类字节码或类classpath等内容的工具,同时JDK1.6还提供了运行过程中的动 态改变,如在方法执行前后加入度量时间的代码,使Java代码可度量就是一个很典型的应用。不过这需要涉及到Java字节码有较深入的理解进行字节码直接编辑改写,或者需要借助开源字节码项目如bcel,ASM或javassist等,以简化对字节码的操作。 2.Instrumentation与Btrace。Btrace是基于Instrumentation和ASM的,只要理解了Instrumentation的原理和ASM对字节码的操作原理,了解Btrace就不困难了。 3.Android的测试框架robotium框架,使用的类也是Instrumentation,其原理应该也类似。为某工程新建了一个测试工程,在安装原有工程项目时,也将测试的工程项目安装到AVD(模拟器)上面,同时通过测试的工程项目来与运行时的项目交互,触发其组件的动作等。这种方
本文标题:robotium学习笔记
链接地址:https://www.777doc.com/doc-6242802 .html