Android automated testing (1) concept of Android automated testing principles and Android principles
I. First, let's talk about the principle of automated mobile phone testing.
1. The principle of mobile phone automated testing is that a control terminal (Test Tool) on the PC is connected to an agent terminal on the mobile phone through serial port, USB, or wireless, then, the test tool is used to send a request or command to the mobile phone. After receiving the command or request, the mobile phone sends it to the agent for resolution, then, the agent sends the parsed commands to all functional modules of the mobile phone and calls the functional modules to simulate the operations. After completing these operations, the mobile phone will return some information, which can be captured by the agent and sent back to the PC end. This completes a complete automated mobile phone test.
2. The key point is the agent. Some companies inject test program response code into the software function module of their mobile phone terminals, and some companies can use MMI_Command to control mobile phone terminals; the principle is to provide a response interface for the mobile phone.
3. for PC controllers, this test script can be defined in various programming languages.
4. Some automated tests are designed to record the recording mechanism. Generally speaking, the recording of manual keyboard information or LCD operation information is required)
5. The building method of the automated testing framework is universal. You need to set up your own testing framework to ensure the smooth development of the automated testing.
Ii. Android automated testing:
1. The CTS and CTS tests are based on the Android instrumentation Test and JUnit tests. To put it bluntly, CTS is a bunch of unit test cases. This is also a good part of Java.
2. The Monkey tool. Monkey is a command line tool in Android and can be run in a simulator or on a real device. It sends a pseudo-random user event stream (such as key input, touch screen input, and gesture input) to the system to perform stress testing on the application being developed. Monkey testing is a fast and effective method to test the stability and robustness of software.
3. ASE indicates the Android script environment, that is, we can use scripts (such as Python) to call Android functions to customize some tests. Such as making phone calls, sending text messages, Browsing webpages, etc. We can expand its APIs (Java part) and use python scripts to call these APIs to implement a wide range of test functions. For some APIs, you can access all the Android APIs. python can be flexibly deployed and tested, so ASE is highly scalable.
4. Robotium. This tool is used for automated testing of the black box. The target application can be used in the case of source code or APK only.
Test. Robotimu provides APIs that mimic user operations, such as clicking on a control and inputting Text
And so on. (Recommend that you study this tool. It is open-source and I have materials)
5. You can develop an automated testing tool for mobile phones on your own, in the same principle.