コード例 #1
0
def runner():
    i=1
    while True:
        kill_adb()
        devicess = AndroidDebugBridge().attached_devices()
        if len(devicess) > 0:
            mk_file()
            l_devices = []
            for dev in devicess:
                app = {}
                app["devices"] = dev
                init(dev)
                app["port"] = str(random.randint(4700, 4900))
                app["bport"] = str(random.randint(4700, 4900))
                app["systemPort"] = str(random.randint(4700, 4900))
                app["app"] = PATH("../app/com.jm.android.jumei_8.601_8601.apk") # 测试的app路径
                #app["app"] = "/Users/vic/work/WORK/Work/Py_script/appium-master/app/android-system-webview-60.apk"  # 测试的app路径,喜马拉雅app
                l_devices.append(app)

            appium_server = AppiumServer(l_devices)
            appium_server.start_server()
            #print(l_devices)
            runnerPool(l_devices)
            writeExcel()
            filepath = PATH("../Report/ReportDetail.xlsx")
            excel_to_html(filepath)
            appium_server.stop_server(l_devices)
            data = getData()
            if data["pass"] >0:
                print("执行成功,发送邮件")
                isSend()
                break
            else:
                time.sleep(5)
                i+=1
                if i==4:
                    print("执行失败")
                    break
                print("执行失败重试三次,第" + str(i) + "次......")
        else:
            print("没有可用的安卓设备")
            break
コード例 #2
0
ファイル: runner_ios.py プロジェクト: dcn01/python-appium
def runnerCaseApp(devices):
    starttime = datetime.now()
    suite = unittest.TestSuite()
    suite.addTest(ParametrizedTestCase.parametrize(HomeTest, param=devices))
    unittest.TextTestRunner(verbosity=2).run(suite)
    endtime = datetime.now()
    countDate(datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
              str((endtime - starttime).seconds) + "秒")


if __name__ == '__main__':

    devicess = get_ios_devices()
    if len(devicess) > 0:
        mk_file('iOS')
        l_devices = []

        for dev in devicess:
            app = {}
            app["devices"] = dev
            app["port"] = str(random.randint(4700, 4900))
            app["bport"] = str(random.randint(4700, 4900))
            app["app"] = BaseInit.ipaPath
            l_devices.append(app)

        appium_server = AppiumServer(l_devices)
        appium_server.start_server()
        runnerPool(l_devices)
        writeExcel()
        appium_server.stop_server(l_devices)
コード例 #3
0
ファイル: runner.py プロジェクト: wsaicyj/AppAuto
    # suite.addTest(ParametrizedTestCase.parametrize(PrivacySet, param=devices))#加入测试类
    # suite.addTest(ParametrizedTestCase.parametrize(GalleryTest, param=devices))
    # suite.addTest(ParametrizedTestCase.parametrize(SettingsTest, param=devices))
    suite.addTest(ParametrizedTestCase.parametrize(LoginTest, param=devices)) #加入测试类
    unittest.TextTestRunner(verbosity=0).run(suite)
    endtime = datetime.now()
    countDate(datetime.now().strftime('%Y-%m-%d %H:%M:%S'), str((endtime - starttime).seconds) + "秒")


if __name__ == '__main__':

    kill_adb()

    devicess = AndroidDebugBridge().attached_devices()
    if len(devicess) > 0:
        mk_file('android')
        l_devices = []
        for dev in devicess:
            app = {}
            app["devices"] = dev
            # init(dev)
            app["port"] = str(random.randint(4700, 4900))
            app["bport"] = str(random.randint(4700, 4900))
            app["systemPort"] = str(random.randint(4700, 4900))
            app["app"] = PATH("../app/NewHealthApp_201901041724_test_v2.8.0.apk")
            # app["app"] = BaseInit.apkPath
            l_devices.append(app)

        appium_server = AppiumServer(l_devices)
        appium_server.start_server()
        runnerPool(l_devices)
コード例 #4
0
ファイル: runner.py プロジェクト: samesky2016/appium-test
    suite = unittest.TestSuite()
    #suite.addTest(ParametrizedTestCase.parametrize(LoginPageTest, param=devices))
    #suite.addTest(ParametrizedTestCase.parametrize(MyPageTest, param=devices)) #加入测试类
    suite.addTest(ParametrizedTestCase.parametrize(JsLifeAppTest, param=devices))  # 加入测试类

    unittest.TextTestRunner(verbosity=2).run(suite)
    endtime = datetime.now()
    countDate(datetime.now().strftime('%Y-%m-%d %H:%M:%S'), str((endtime - starttime).seconds) + "秒")

if __name__ == '__main__':

    kill_adb()

    devicess = AndroidDebugBridge().attached_devices()
    if len(devicess) > 0:
        mk_file()
        l_devices = []
        for dev in devicess:
            app = {}
            app["devices"] = dev
            # 注释掉重现安装
            #init(dev)
            #生成appium端口,appium-desktop端口默认为:4723
            #app["port"] = str(4723)
            app["port"] = str(random.randint(4700, 4900))
            app["bport"] = str(random.randint(4700, 4900))
            app["systemPort"] = str(random.randint(4700, 4900))
            app["app"] = PATH("../app/com.jieshun.jslife.apk") # 测试的app路径,捷生活app

            l_devices.append(app)
コード例 #5
0
ファイル: runner.py プロジェクト: bingbing1123/appium
def runnerCaseApp(devices):
    starttime = datetime.now()
    suite = unittest.TestSuite()
    suite.addTest(ParametrizedTestCase.parametrize(HomeTest, param=devices))
    # suite.addTest(ParametrizedTestCase.parametrize(HomeTest, param=devices)) #加入测试类
    unittest.TextTestRunner(verbosity=2).run(suite)
    endtime = datetime.now()
    countDate(datetime.now().strftime('%Y-%m-%d %H:%M:%S'), str((endtime - starttime).seconds) + "秒")

if __name__ == '__main__':

    kill_adb()

    devicess = AndroidDebugBridge().attached_devices()
    if len(devicess) > 0:
        mk_file()
        l_devices = []
        for dev in devicess:
            app = {}
            app["devices"] = dev
            init(dev)
            app["port"] = str(random.randint(4700, 4900))
            app["bport"] = str(random.randint(4700, 4900))
            app["systemPort"] = str(random.randint(4700, 4900))
            app["app"] = PATH("../app/com.ximalaya.ting.android.apk") # 测试的app路径,喜马拉雅app

            l_devices.append(app)

        appium_server = AppiumServer(l_devices)
        appium_server.start_server()
        runnerPool(l_devices)