Skip to content

Commit a93e735

Browse files
author
Wu Xiaoliang
committed
use github to manage code
0 parents  commit a93e735

24 files changed

+2287
-0
lines changed

BrowserLaunch.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env python
2+
3+
from argparse import ArgumentParser
4+
import sys
5+
6+
import adbhelper
7+
from qalaunchtime import doQALaunchTime
8+
import locationmanager
9+
10+
pair = locationmanager.getLocation("4")
11+
x = pair[0]
12+
y = pair[1]
13+
14+
layer = "SurfaceView"
15+
packageName = "com.android.chrome"
16+
time = 2
17+
repeatCount = 10
18+
outputName = "Browser_LaunchTime\(%s\).launch" % (
19+
adbhelper.getDeviceInfo())
20+
qaArgs = {}
21+
qaArgs["x"] = x
22+
qaArgs["y"] = y
23+
qaArgs["layer"] = layer
24+
qaArgs["packageName"] = packageName
25+
qaArgs["time"] = time
26+
qaArgs["repeatCount"] = repeatCount
27+
qaArgs["outputfile"] = outputName
28+
29+
p = ArgumentParser(usage='qalaunchtime.py -d -f input -o output -d delay', description='Author wxl')
30+
p.add_argument('-m', default=0, dest='mode', type=int, help='mode')
31+
args = p.parse_known_args(sys.argv)
32+
doQALaunchTime(qaArgs)

CalculationLaunch.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env python
2+
3+
from argparse import ArgumentParser
4+
import sys
5+
6+
from qalaunchtime import doQALaunchTime
7+
import adbhelper
8+
import locationmanager
9+
10+
pair = locationmanager.getLocation("1")
11+
x = pair[0]
12+
y = pair[1]
13+
14+
layer = "com.android.calculator2/com.android.calculator2.Calculator"
15+
packageName = "com.android.calculator2"
16+
time = 2
17+
repeatCount = 10
18+
outputName = "Calculator_LaunchTime\(%s\).launch" % (
19+
adbhelper.getDeviceInfo())
20+
qaArgs = {}
21+
qaArgs["x"] = x
22+
qaArgs["y"] = y
23+
qaArgs["layer"] = layer
24+
qaArgs["packageName"] = packageName
25+
qaArgs["time"] = time
26+
qaArgs["repeatCount"] = repeatCount
27+
qaArgs["outputfile"] = outputName
28+
29+
30+
p = ArgumentParser(usage='qalaunchtime.py -d -f input -o output -d delay', description='Author wxl')
31+
p.add_argument('-m', default=0, dest='mode', type=int, help='mode')
32+
args = p.parse_known_args(sys.argv)
33+
doQALaunchTime(qaArgs)

ContactLaunch.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env python
2+
3+
from argparse import ArgumentParser
4+
import sys
5+
6+
import adbhelper
7+
from qalaunchtime import doQALaunchTime
8+
import locationmanager
9+
10+
pair = locationmanager.getLocation("4")
11+
x = pair[0]
12+
y = pair[1]
13+
14+
layer = "com.android.contacts/com.android.contacts.activities.PeopleActivity"
15+
packageName = "com.android.contacts"
16+
time = 2
17+
repeatCount = 10
18+
outputName = "Contact_LaunchTime\(%s\).launch" % (
19+
adbhelper.getDeviceInfo())
20+
qaArgs = {}
21+
qaArgs["x"] = x
22+
qaArgs["y"] = y
23+
qaArgs["layer"] = layer
24+
qaArgs["packageName"] = packageName
25+
qaArgs["time"] = time
26+
qaArgs["repeatCount"] = repeatCount
27+
qaArgs["outputfile"] = outputName
28+
29+
p = ArgumentParser(usage='qalaunchtime.py -d -f input -o output -d delay', description='Author wxl')
30+
p.add_argument('-m', default=0, dest='mode', type=int, help='mode')
31+
args = p.parse_known_args(sys.argv)
32+
doQALaunchTime(qaArgs)

MyEnv.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import os
2+
3+
envDic = {}
4+
HOME = os.environ.get("HOME")
5+
dicPath = "%s/.myPythonEnv" % HOME
6+
initFlag = False
7+
8+
def setMyPythonEnv(key, value):
9+
global initFlag
10+
global dicPath
11+
if not initFlag:
12+
loadDic(dicPath)
13+
envDic[key] = value
14+
saveDic(dicPath)
15+
def getMyPythonEnv(key):
16+
global initFlag
17+
global dicPath
18+
if not initFlag:
19+
loadDic(dicPath)
20+
return envDic.get(key)
21+
22+
def loadDic(dicPath):
23+
global envDic
24+
fp = open(dicPath, "a+")
25+
envList = fp.readlines()
26+
'''
27+
repeatCount 2
28+
'''
29+
for line in envList:
30+
element = line.split(":")
31+
envDic[element[0]] = element[1].strip()
32+
33+
fp.close()
34+
35+
def saveDic(dicPath):
36+
global envDic
37+
fp = open(dicPath, "w+")
38+
for key, value in envDic.items():
39+
fp.write(key)
40+
fp.write(":")
41+
fp.write(value)
42+
fp.write("\n")
43+
fp.flush()
44+
fp.close()
45+
46+
def getArg(key, returnType):
47+
lastArg = getMyPythonEnv(key)
48+
arg = raw_input(("%s(%s): " % (key, lastArg)))
49+
if arg == "":
50+
arg = lastArg
51+
else:
52+
setMyPythonEnv(key, arg)
53+
if returnType == "int":
54+
return int(arg)
55+
elif returnType == "str":
56+
return arg

README

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
UX Test Script

SettingLaunch.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env python
2+
3+
from argparse import ArgumentParser
4+
import sys
5+
6+
from qalaunchtime import doQALaunchTime
7+
import adbhelper
8+
import locationmanager
9+
10+
pair = locationmanager.getLocation("4")
11+
x = pair[0]
12+
y = pair[1]
13+
14+
layer = "com.android.settings/com.android.settings.Settings"
15+
packageName = "com.android.settings"
16+
time = 2
17+
repeatCount = 10
18+
outputName = "Settings_LaunchTime\(%s\).launch" % (
19+
adbhelper.getDeviceInfo())
20+
qaArgs = {}
21+
qaArgs["x"] = x
22+
qaArgs["y"] = y
23+
qaArgs["layer"] = layer
24+
qaArgs["packageName"] = packageName
25+
qaArgs["time"] = time
26+
qaArgs["repeatCount"] = repeatCount
27+
qaArgs["outputfile"] = outputName
28+
29+
30+
p = ArgumentParser(usage='qalaunchtime.py -d -f input -o output -d delay', description='Author wxl')
31+
p.add_argument('-m', default=0, dest='mode', type=int, help='mode')
32+
args = p.parse_known_args(sys.argv)
33+
doQALaunchTime(qaArgs)

YoutubeLaunch.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env python
2+
3+
from argparse import ArgumentParser
4+
import sys
5+
6+
import adbhelper
7+
from qalaunchtime import doQALaunchTime
8+
import locationmanager
9+
10+
pair = locationmanager.getLocation("4")
11+
x = pair[0]
12+
y = pair[1]
13+
14+
layer = "com.google.android.youtube/com.google.android.apps.youtube.app.WatchWhileActivity"
15+
packageName = "com.google.android.youtube"
16+
time = 5
17+
repeatCount = 10
18+
outputName = "Youtube_LaunchTime\(%s\).launch" % (
19+
adbhelper.getDeviceInfo())
20+
qaArgs = {}
21+
qaArgs["x"] = x
22+
qaArgs["y"] = y
23+
qaArgs["layer"] = layer
24+
qaArgs["packageName"] = packageName
25+
qaArgs["time"] = time
26+
qaArgs["repeatCount"] = repeatCount
27+
qaArgs["outputfile"] = outputName
28+
29+
p = ArgumentParser(usage='qalaunchtime.py -d -f input -o output -d delay', description='Author wxl')
30+
p.add_argument('-m', default=0, dest='mode', type=int, help='mode')
31+
args = p.parse_known_args(sys.argv)
32+
rsd = 9
33+
attemp = 0
34+
while rsd > 8 and attemp < 5:
35+
print "attemp %d\n" % attemp
36+
attemp += 1
37+
rsd = doQALaunchTime(qaArgs)

adb.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import subprocess
2+
import time
3+
import os
4+
import sys
5+
from clog import clog
6+
7+
clog = clog()
8+
clog.setLevel("e|v|d")
9+
class adb:
10+
serial = ""
11+
12+
def __init__(self):
13+
print "init"
14+
15+
@staticmethod
16+
def devices():
17+
p = subprocess.Popen("adb devices -l", shell = True, stdout = subprocess.PIPE)
18+
content = p.stdout.readlines()
19+
choice = 0
20+
if (len(content) > 3):
21+
for i in xrange(1, len(content) - 1):
22+
print ("%d: %s" % (i, content[i].strip()))
23+
choice = raw_input("Please choose deivce(%d-%d): " % (1, len(content) - 2))
24+
elif (len(content) == 3):
25+
choice = 1
26+
27+
if choice == 0:
28+
clog.e("No devices!")
29+
sys.exit()
30+
else:
31+
clog.d(content[choice].strip())
32+
return content[choice]
33+
34+
35+
adb.devices()
36+
37+
38+
39+
40+

0 commit comments

Comments
 (0)