summaryrefslogtreecommitdiff
path: root/support/app_utils/airtest_control.py
blob: 8b010de6998bd565f05cba9a05ef4bf0a8515ee7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import argparse

def run_script(device_id, app_name):
    test_device_id = device_id
    app_operation = "open"
    packet_name = app_name
    report_name = app_name + "_report"
    rootDirectory = os.path.dirname(os.path.abspath(__file__))
    command = "python " + rootDirectory + "/app"
    if test_device_id == "http+usbmux://00008101-001951312251001E":
        print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], command + "/" + app_name + "/" + app_name + "_ios" + ".py" + " " + "-d " + test_device_id + " -n " + app_name + " -o " + app_operation + " -p " + packet_name + " -r " + report_name)
        result = os.system(command + "/" + app_name + "/" + app_name + "_ios" + ".py" + " " + "-d " + test_device_id + " -n " + app_name + " -o " + app_operation + " -p " + packet_name + " -r " + report_name)
    elif test_device_id == "http+usbmux://00008020-000244CE1A8A002E":
        print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], command + "/" + app_name + "/" + app_name + "_ios" + ".py" + " " + "-d " + test_device_id + " -n " + app_name + " -o " + app_operation + " -p " + packet_name + " -r " + report_name)
        result = os.system(command + "/" + app_name + "/" + app_name + "_ios" + ".py" + " " + "-d " + test_device_id + " -n " + app_name + " -o " + app_operation + " -p " + packet_name + " -r " + report_name)
    else:
        print(datetime.now().strftime("%Y-%m-%d %H:%M:%S"), str(datetime.now().microsecond)[:3], command + "/" + app_name + "/" + app_name + ".py" + " " + "-d " + test_device_id + " -n " + app_name + " -o " + app_operation + " -p " + packet_name + " -r " + report_name)
        result = os.system(command + "/" + app_name + "/" + app_name + ".py" + " " + "-d " + test_device_id + " -n " + app_name + " -o " + app_operation + " -p " + packet_name + " -r " + report_name)
    return result

if __name__ == '__main__':
    run_script("AWMCUT1325002090", "taobao")