Preliminary study on Androiddriver Principle--android automatic Test course

Source: Internet
Author: User

Main content and notes:

First, Androiddriver core principle

Resolution of the pair:

PC-side port through ADB, the Android version of the remote server APK push to the phone, and then to the mobile phone Terminal remote server communication, the mobile phone terminal remote server and the browser to communicate, Webdriver inject JS script into the browser to complete the desired function

All control-based automation frameworks call instrumentation, or encapsulate it, such as the previous robotium, etc.

Second, androiddriver source analysis

1, io.selendroid inside the multi-threading

In Robotium, the action on the UI will also involve this part, need to be runonuithread to make the correct call, otherwise you will be prompted to error

uithreadcontroller.java--Walk Multi-threading, is in order to not let the main thread stuck, in the usual test process is found similar to such problems, if the development of some processing directly in the main thread to do, it will be very easy to appear stuck to the bug

For example, some touch response operations, or KeyEvent events, should be placed in the sub-thread for processing, but the development in the process: it should be through the main line generates into a sub-thread, and then authorize the child thread to do the relevant things, then when we process the program, For example, some mouseevent events, should be used to handler callback, the principle of which there are some areas are not very clear, but it should be: through the handler to send a message to the program, disguised as the main thread, so that you can have permissions corresponding to the relevant operation, otherwise such as "on the The operation of the program cannot be done by the not original thread.

2, io.selendroid.android inside of the Instrumentedkeysender

This class has a final member variable instrumentation, which first passes the instrumentation instrumentation of the phone to this member variable

After this value is obtained, the asynchronous operation is performed: Instrumentation.waitforidlesync () and then in try: Sendkeysync ( Inside the call or the monkey and Monkeyrunner inside the hidden Interface: touch operation)

3, Io.selendroid.server.handler inside of clearelement, clickelement, etc., are in this handler inside

4, io.selendroid.server.modle--to the data storage and processing, are placed in the modle inside, this is the MVC m, then V is the display, C is control

5, it inherits the selenium thing, for example Selenium's search control method, various by AH

6. js Script Injection

Third, gossip light part:

I am currently in the use of Robotium write test case, from check data, how to frame, to start to write a program with two days of time, the basic write program, use a week time bar, really use up or very quickly, feel mastered some things, and then come back to see this video, I feel a lot of things very familiar And it's relatively easy to understand.

Then, we should first put Robotium test framework, the development process encountered problems summed up, then look at the source code, and then to better understand the solution of the problem, and now, I am the multi-threaded God horse is not smattering, is not understand, to try to write Ah, Java program Although said soon to get started, can write, but think still need to make the most basic knowledge of Java to clear, what reflection callback and so on, and interface what, refueling, refueling!! Don't be afraid, do it at 1.1, it will be more and more great!!!!

NetEase Cloud Classroom: http://study.163.com/course/courseMain.htm?courseId=712011

Golden Sun Test

Sina Weibo: Golden Sun Woody

Website address

1, Baidu Search: Golden Sunshine test

2. Official website: www.goldensunshine.cc

Public number

Preliminary study on Androiddriver Principle--android automatic Test course

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.