pool.map(runnerCaseApp, dev) pool.close() pool.join() def runnerCaseApp(devices): '''利用unittest的testsuite来组织测试用例''' test_suit = unittest.TestSuite() test_suit.addTest(Parmer.parametrize(regtest, param=devices)) # 扩展的其他的测试用例均这样添加 unittest.TextTestRunner(verbosity=2).run(test_suit) if __name__ == "__main__": LOG.info("测试开始执行") start_time = datetime.datetime.now() makecasefile('reg', 'reg', 'reg') path = os.getcwd() filenm = path + '/testreport/' + 'result.xls' devicess = connectmobile() listport = [] if len(devicess) > 0: for dev in devicess: app = {} app["devices"] = dev port = str(random.randint(4593, 4598)) app["port"] = port l_devices.append(app) listport.append(port) appium_server = AppiumServer(l_devices) appium_server.start_server() # 启动服务 runnerPool(l_devices)
test_suit = unittest.TestSuite() test_suit.addTest(Parmer.parametrize(testcase_klass=regtest, param=devices)) # 扩展的其他的测试用例均这样添加 unittest.TextTestRunner(verbosity=2).run(test_suit) if __name__ == "__main__": LOG.info("测试开始执行") start_time = datetime.datetime.now() devicess = [] if Test_mobile_type == 'Android': devicess = AndroidDebugBridge().attached_devices() else: #todo 本地获取链接的ios设备 pass makecasefile('reg', 'reg', 'reg') # 没有的时候才会生成,一般都会有这个文件 path = os.getcwd() report_path = os.path.join(path, "testreport") filenm = report_path + 'result.xls' if len(devicess) > 0: for dev in devicess: app = {} app["devices"] = dev app["port"] = str(random.randint(4593, 4598)) l_devices.append(app) appium_server = AppiumServer(l_devices) appium_server.start_server() # 启动服务 runnerPool(l_devices) try: appium_server.stop_server(devicess) except Exception as e: