Turn from: http://www.robotium.cn/archives/799 AM Instrument [flags] <COMPONENT>-r:print RAW Results (o Therwise decode Report_key_streamresult), prints the original results. Collects useful raw performance data. -e <NAME> <value>: set argument <NAME> to <value>, sets the name of the parameter. -P <file>: writes data to an external file. -W: Generally required, otherwise you cannot see the test results.
Type 1 Run all Test
This command is used to perform all test classes under test engineering: ADB shell am instrument-w com.example.test/android.test.instrumentationtestrunner here my The test project package is named Com.example.test.
Type 2 Running tests from a specific test case
To perform all the tests in a test class, you can use the following command: ADB shell am instrument-w-E class Com.example.test.testA Com.example.test/android.test . Instrumentationtestrunner
One of my test classes here is named Testa.
Type 3 Running a specific test by name
To perform a specific test in a test class, you can use the following command: ADB shell am instrument-w-E class com.huawei.mao.test.testa\ #testadd4 com.huawei.ma O.test/android.test.instrumentationtestrunner here testadd4 is a specific test in the test class Testa.
Type 4 Running specific tests by categoryThe tests can be divided into different categories by using the description in this category (test notes) to differentiate, you can run all the tests of a class of test annotations. You can use the following command: ADB shell am instrument-w-E size Small Com.example.test/android.test.instrumentationtestrunner
What I do here is all the tests in the package that are annotated with @smalltest.
Create custom Annotations
Sometimes we need to perform some specific tests, and maybe these tests are not fixed. At this point we can use some custom annotations to implement, after the change test only need to change the test note. Here's how to write a custom note: package com.example.test; Public @interface Importanttest {} OK, now we can use the command: ADB shell am instrument-w-e annotation importanttest \c Om.example.test/android.test.instrumentationtestrunner
Several common types of command-line startup apps