GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — AndroidPerformanceTest_Python/V1.0/Monkey_Script.py at master · nanaliu/AndroidPerformanceTest_Python

Expand file tree

/

Monkey_Script.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
34 lines (28 loc) · 1.51 KB
/

Monkey_Script.py

Copy path

File metadata and controls

34 lines (28 loc) · 1.51 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- coding: utf-8 -*-
import os, re,sys
import subprocess
import time, os, sched,shlex,threading
from reportlab.graphics.shapes import *
from reportlab.graphics.charts.lineplots import LinePlot
from reportlab.graphics.charts.textlabels import Label
from reportlab.graphics import renderPDF
def now_time():
localtime = time.asctime( time.localtime(time.time()) )
time_array = localtime.split(" ")[3].split(":")
return time_array[0]+'_'+time_array[1]+"_"+time_array[2]
def run_monkey(param,package_name,count,waittime):
try:
if param == 'Normal':
subprocess.Popen("adb shell monkey -p %s --pct-motion 20 --pct-trackball 0 --pct-touch 40 --pct-nav 10 --ignore-crashes --ignore-timeouts --throttle 300 -v -v -v %d >MonkeyTest_Report_%s.txt"%(package_name,count,now_time()),shell=True)
if param == 'alltouch':
subprocess.Popen("adb shell monkey -p %s --pct-touch 100 --ignore-crashes --ignore-timeouts --throttle 300 -v -v -v %d >MonkeyTest_Report_%s.txt"%(package_name,count,now_time()),shell=True)
if param == 'other':
subprocess.Popen("adb shell monkey -p %s --pct-majornav 30 --pct-syskeys 30 --pct-anyevent 30 --ignore-crashes --ignore-timeouts --throttle 300 -v -v -v %d >MonkeyTest_Report_%s.txt"%(package_name,count,now_time()),shell=True)
print 'Monkey日志正在记录中。。。请稍后'
time.sleep(float(waittime)*1)
except KeyboardInterrupt:
print '报告正在生成'
os.system('adb kill-server')
os.system('adb devices')
if __name__ == '__main__':
run_monkey(sys.argv[1],sys.argv[2],argv[3],argv[4])
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.