Play with Android commands in a short time

Source: Internet
Author: User

Android is a Linux kernel-based software platform and operating system. It was developed by Google in the early days. The following describes Android commands. I hope you can find the desired information after reading this article.

Each TestSuite contains several TestCase (a class that inherits junit. framework. TestCase of android. jar ). Each TestCase contains several Test (specific test method ). Assume that com. android. foo is the root of your test code package. When the following command is executed, all tests of all TestCase are executed. The test object is the code in the Package specified in the Target Package:

If you want to run a TestSuite, first inherit android. jar's junit. framework. testSuite class to implement a TestSuite (such as com. android. foo. myTestSuite), and then execute the following command to execute the TestSuite where-e represents additional parameters, Syntax:-e [arg1] [value1] [arg2] [value2]… The class parameter is used here. If you only want to run a TestCase (for example, com. android. foo. MyTestCase), run the following command:

Then, all the test results will be output to the console and a series of statistics will be made. For example, if Error is marked as E and Failure is marked as F, the Success test is marked as a vertex. This is consistent with the meaning of JUnit. If you want to debug your test with a breakpoint, you only need to add the breakpoint directly to the code, and then append-e of the running command parameter with debug true to run it.

For more details, see the Javadoc of InstrumentationTestRunner. I hope Android will have a formal document to introduce this content as soon as possible. Several annotations are defined in the android. test. annotation package, including @ LargeTest, @ MediumTest, @ SmallTest, @ Smoke, and @ Suppress.

You can use the annotation to classify your tests based on your needs. When executing a unit test command, you can set "size large", "size medium", and "size small" after the-e parameter to execute a test with corresponding labels. In particular, @ Supperss can cancel the execution of the marked Test.


 

In the above steps, in the example provided by the Android command, I found that it has two manifest. xml. That is to say, in step 3, the source code and test code generate two different packages respectively. Step 4 Use the adb install command to install it on the virtual machine.

Since I didn't find Eclipse ADT, there is a way to package and install an Application with only Instrumentation and no Activity, so I used a slightly different method to complete this work. The entire process is described in detail in the following sections.

In the above steps, in the example provided by the Android command, I found that it has two manifest. xml. That is to say, in step 3, the source code and test code generate two different packages respectively. Step 4 Use the adb install command to install it on the virtual machine.

Since I have not found Eclipse ADT, there is a way to be one with only Instrumentation. The Application without Activity is packaged and installed, so a slightly different method is used to complete the work. The entire process is described in detail in the following sections.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.