def report(): workbook = xlsxwriter.Workbook('GetReport.xlsx') worksheet = workbook.add_worksheet("测试总况") worksheet2 = workbook.add_worksheet("测试详情") print(common.RRPORT) b_OperateReport = b_report.OperateReport(wd=workbook, data=common.RRPORT) b_OperateReport.init(worksheet) b_OperateReport.detail(worksheet2) b_OperateReport.close() b_email.send_mail(get_email()) if __name__ == '__main__': if ga.selenium_appium == common.APPIUM and ga.platformName == common.ANDROID: if adbCommon.attached_devices(): appium_server = server.AppiumServer(ga.appiumJs, ga.Remote, ga.selenium_appium) appium_server.start_server() while not appium_server.is_runnnig(): time.sleep(2) runnerCaseApp() appium_server.stop_server() else: print(u"设备不存在") if ga.selenium_appium == common.SELENIUM: appium_server = server.AppiumServer(ga.selenium_jar, ga.sel_remote, ga.selenium_appium) appium_server.start_server() while not appium_server.is_runnnig(): time.sleep(2) runnerCaseWeb() appium_server.stop_server()
b_OperateReport.close () # b_email.send_mail(get_email()) def open_web_server(): web_server = HTTPServer ((common.HOST, common.PORT), myserver.myHandler) web_server.serve_forever () if __name__ == '__main__': ga = get_devices () if adbCommon.attached_devices (): p = Process (target=open_web_server, args=()) p.start () appium_server = server.AppiumServer (ga) appium_server.start_server () while not appium_server.is_runnnig (): time.sleep (2) runnerPool () appium_server.stop_server () subprocess.Popen ("taskkill /F /T /PID " + str (p.pid), shell=True) # web_server.server_close() #关闭webserver operateFile.OperateFile (common.REPORT_COLLECT_PATH).remove_file () operateFile.OperateFile (common.REPORT_INIT).remove_file () operateFile.OperateFile (common.REPORT_INFO_PATH).remove_file () operateFile.OperateFile (common.CRASH_LOG_PATH).remove_file () else: print(u"设备不存在")
result = False elif not operateYaml.get_yaml(case["casePath"]): result = False return result if __name__ == '__main__': log.info( "===============================Start===================================" ) devices_conf_yaml = PATH("../devices.yaml") if len(sys.argv) > 0: devices_conf_yaml = PATH(sys.argv[0]) devices_conf = operateYaml.get_yaml(PATH(devices_conf_yaml)) if adbCommon.attached_devices(): appium_server = server.AppiumServer(devices_conf) appium_server.start_server() while not appium_server.is_running(): time.sleep(2) runner_pool(devices_conf) appium_server.stop_server() operateFile.OperateFile(Constants.REPORT_COLLECT_PATH).remove_file() operateFile.OperateFile(Constants.REPORT_INIT).remove_file() operateFile.OperateFile(Constants.REPORT_INFO_PATH).remove_file() operateFile.OperateFile(Constants.CRASH_LOG_PATH).remove_file() else: log.error(u"设备不存在") log.info( "=======================================End=====================================" )