In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article shares with you the content of the sample analysis of Monkey testing in python. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. Monkey is a command line tool in Android, which can be run in a simulator or a real device.
It sends a pseudo-random stream of user events (such as button input, touchscreen input, gesture input, etc.) to the system to test the stress of the application under development.
2. Monkey testing is a fast and effective method to test the stability and robustness of software.
The tool is used for stress testing. The developer then combines the logs printed by monkey and the logs printed by the system to analyze the problems in the test.
Example
Monkeyss executes the Monkey command:
From data.raad_yaml import OpenYamlimport osimport gevent def get_devices (): command_result = ("adb devices") # execute the adb command to determine whether the device is connected properly mydevice = os.popen (command_result) # execute the adb command mystr = mydevice.read () # get the contents of the command splits = mystr [25:41] # get the device number mal = OpenYaml () # read yaml File if splits in mal.getdata () ['data'] [' phone']: "phone: the device number can be changed in the yaml file to determine whether the device is connected successfully. If you are not connected or the device number is incorrect, do not execute ~ "" print ('device connection is normal Start Monkey command ~') MonkeyCmd = "adb shell monkey-p% s-- pct-touch% s-v-ignore-crashes-- ignore-timeouts% s-s% s-- throttle% s 1 >% s 2 >% s"\% (mal.getdata () ['data'] [' packages'], # test package name mal.getdata () ['data'] [' touch'] # display details Randomly execute 80 events mal.getdata () ['data'] [' monkeyclickcount'], # clicks mal.getdata () ['data'] [' send'], # to specify the threshold value mal.getdata () ['data'] [' throttle'] of the pseudorandom number generator, # the delay of the event Unit is millisecond mal.getdata () ['data'] [' path_text'], # run log save path mal.getdata () ['data'] [' error']) # error log save path os.popen (MonkeyCmd) "" if some events are not executed, comment them out on the command line Note to delete the corresponding% s value "" print ('execute command:', MonkeyCmd) else: print ('device link failed, please check the device connection and try again ~ / or whether the device number is correct:', splits) get_devices () Thank you for reading! This is the end of this article on "sample Analysis of Monkey testing in python". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.