Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the Android command

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

In this issue, the editor will bring you about how to use the Android command. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

Android is a software platform and operating system based on the Linux kernel, which was developed by Google in the early days. The following is about Android commands. I hope you can find the information you want after reading this article.

Each TestSuite contains several TestCase (some class that inherits android.jar 's junit.framework.TestCase). Each TestCase also contains several Test (specific test methods). If you assume that com.android.foo is the root of your test code's package. When the following command is executed, all Test for all TestCase is executed. The object to be tested is the code in the package specified in Target Package:

If you want to run a TestSuite, first inherit android.jar 's junit.framework.TestSuite class, 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 just want to run a TestCase (such as com.android.foo.MyTestCase), use the following command:

Then, all the test results will be output to the console and a series of statistics will be done, such as the test marked E is Error and the test marked F is Failure,Success will be marked as a point. This is consistent with the semantics of JUnit. If you want breakpoints to debug your tests, just add breakpoints directly to the code, and then append debug true to the-e of the run command parameter and run it.

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

You can use these annotation to categorize your tests according to your needs. When you execute a unit test command, you can set "size large" / "size medium" / "size small" after the-e parameter to execute the test with the appropriate flag. The special @ Supperss can cancel the execution of the marked Test.

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

Since I couldn't find a way for Eclipse ADT to package and install an Application with only Instrumentation and no Activity, I took a slightly different approach to do the job. The whole process will be described in detail one by one below.

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

Since I couldn't find Eclipse ADT there is a way for only Instrumentation. Application without Activity was packaged and installed, so it was done in a slightly different way.

The above is the editor for you to share how to use the Android command, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report