Joke Collection Website - Blessing messages - How to use python to write android monkey tests

How to use python to write android monkey tests

1. First, let’s talk about the principle of mobile phone automated testing 1. The principle of mobile phone automated testing is a control terminal (test tool) on the PC and an agent terminal on the mobile phone, through the serial port, USB or wireless method. The PC is connected to the mobile phone terminal, and then the test tool is used to send requests or commands to the mobile phone. After the mobile phone receives the command or request, it is handed over to the agent for analysis, and then the agent issues these analyzed commands to the functions that can be recognized by each functional module of the mobile phone. command to call those function modules to simulate operations. After completing these operations, the mobile phone will return some information, which the agent can capture and then send back to the PC. This completes a complete mobile phone automated test. 2. The key point lies in the agent. Some companies implant test program response codes into the software function modules of their mobile terminals. Some companies can use MMI_Command to control the mobile terminal; the principle is to provide a responsive interface for the mobile phone. . 3. For the PC control end, this test script can be used in various programming languages. See how to define it. 4. The automated test is designed as a recording mechanism. To put it simply, it is to record manual keyboard information or LCD operations. Information (LCD needs to use an intelligent recognition mechanism) 5. The method of building an automated testing framework is universal. You need to have your own testing framework to ensure the smooth development of automated testing. 2. Android automated testing direction: 1. CTS. CTS testing is based on Android instrumentation testing, which is based on JUnit testing. To put it bluntly, CTS is a bunch of unit test cases. This is also what the Java language is good at. 2. Monkey tool. Monkey is a command line tool in Android that can run in the emulator or on the actual device. It sends a pseudo-random user event stream (such as key input, touch screen input, gesture input, etc.) to the system to implement stress testing of the application under development. Monkey testing is a fast and effective method to test the stability and robustness of software. 3. ASE, ASE means Android scripting environment, that is, we can call Android functions through scripts (such as Python) to customize some tests. Such as making phone calls, sending text messages, browsing the web, etc. We can extend its API (Java part) and call these APIs with python scripts to achieve rich testing functions. For the API part, you can access all Android APIs, and python can flexibly deploy tests, so the scalability of ASE is very good. 4. Robotium, this tool is used for automated testing of black boxes. The target application can be tested with source code or only APK. Robotimu provides APIs that imitate user operations, such as clicking on a control, entering Text, etc. (I recommend that you study this tool. It is open source and I have the information.) 5. You can develop an automated testing tool for mobile phones by yourself. The principle is the same. If you want any information or want to study and study together, you can give it to me. Send email: test_sunny@hotmail.com