robotium命令行启动

命令行启动启动的几种常用类型

                    -r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT),打印的原始结果。收集有用的原始性能数据。
                    -e <NAME> <VALUE>: set argument <NAME> to <VALUE>,设置参数的名字。
                    -p <FILE>: 往外部文件写入数据。
                    -w: 一般为必填,否则无法看到测试结果。


Type 1    Run All Test
        该命令用于执行测试工程下面所有的测试类:
        adb shell am instrument -w com.example.test/android.test.InstrumentationTestRunner
        此处我的测试工程包名为com.example.test。
 
Type 2    Running tests from a specific test case
        如想执行某个测试类中所有测试,你可以使用以下命令:
        adb shell am instrument -w -e class  com.example.test.testA com.example.test/android.test.InstrumentationTestRunner        
        此处我的某一个测试类名为testA。
 
Type 3    Running a specific test by name
        如想执行某个测试类中某一个具体的测试,你可以使用以下命令:
        adb shell am instrument -w -e class com.huawei.mao.test.testA\#testadd4 com.huawei.mao.test/android.test.InstrumentationTestRunner
        此处testadd4为测试类testA中的一个具体的测试。
 
Type 4    Running specific tests by category
       测试可以分为不同的类别,通过使用在这个类别的说明(测试注解)来区分,你可以运行某类测试注解的所有测试。你可以使用以下命令:
        adb shell am instrument -w -e size small com.example.test/android.test.InstrumentationTestRunner
        此处我执行的是包里所有用@SmallTest注解的测试。
 
创建自定义注解
        有时候我们需要执行一些特定的测试,也许这些测试不是固定的。此时我们可以通过一些自定义注解来实现,变更测试后只需要把测试的注解改变一下即可。以下是如何写一个自定义注解:
        package com.example.test;
        public @interface ImportantTest {
        }
        OK,现在我们可以使用命令:adb shell am instrument -w -e annotation ImportantTest \com.example.test/android.test.InstrumentationTestRunner
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值