6th Chapter 8 "Monkeyrunner Source code Analysis" Monkey principle-Event Source-Event Source Overview-Summary

Source: Internet
Author: User

In this chapter we focus on the event source that deals with the commands of the network Monkeysourcenetwork to illustrate how learning Monkey handles Monkeyrunner commands. Following is a summary of the process of Monkeyrunner from starting monkey to how to handle the completion of a command:

    • monkeyrunner send Shell command "Monkey--port 12345" via ADB to start monkey
    • monkey start running into Runmonkeycycles method to loop get and execute event
    • runmonkeycycles method first determines that the--port event source needs to be initialized to handle the network command
    • based on the start command line parameter "Monkeysourcenetwork".
    • after initializing the event source, Runmonkeycycles invokes the getnextevent of the event source to try to get an event to execute the
    • Event source when trying to get an event, go to the command queue to see if there are any events, and then return directly to the Runmonkeycycles to perform the event injection, and continue down without saying:
      • < Span class= "S1" to parse the command string's commands, and then refer to Command_map to get the command for the command translation object
      • Call the Translatecommand method of the command translation object to establish the corresponding event object according to the command and command parameters
    • Enter Runmonkeycycles's next loop to get event execution

Finally, take a look at the flowchart below for a description of the entire command acquisition, translation, build event, and injection event flow:


Figure 6-8-1 Network Event processing flowchart

Note: More articles please pay attention to the public number: Techgogogo or personal blog http://techgogogo.com. Of course, you are also very welcome to pick up directly (ZHUBAITIAN1). This article by Heaven Zhuhai Branch Rudder original. Reproduced please consciously, whether the complaint rights to look at the mood.


6th Chapter 8 "Monkeyrunner Source code Analysis" Monkey principle-Event Source-Event Source Overview-Summary

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.