class RunMain: def __init__(self): self.server = Server() self.server.main() self.case_data = GetCaseExcelData() self.action_method = ActionMethod() def run_method(self): lines = self.case_data.get_case_lines() for i in range(2, lines + 1): handle_step = self.case_data.get_handle_step(i) handle_element = self.case_data.get_handle_element(i) handle_value = self.case_data.get_handle_value(i) expect_step = self.case_data.get_expect_step(i) expect_element = self.case_data.get_expect_element(i) excute_method = getattr(self.action_method, handle_step) if handle_element is None: excute_method(handle_value) else: excute_method(handle_element, handle_value) if expect_step is not None: expect_excute_method = getattr(self.action_method, expect_step) result = expect_excute_method(expect_element) if result is not None: self.case_data.write_result(i, 'pass') else: self.case_data.write_result(i, 'fail')
def run_method(self): print "start runmethod..." server = Server() server.main() case_data = GetCaseData(0) action_method = ActionMothod(0) lines = case_data.get_case_lines() for i in range(1, lines): handle_step = case_data.get_handle_step(i) element_key = case_data.get_element_key(i) handle_value = case_data.get_handle_value(i) expect_element = case_data.get_except_element(i) expect_step = case_data.get_except_step(i) handle_method = getattr(action_method, handle_step) if element_key != '': handle_method(element_key, handle_value) else: handle_method(handle_value) print u"预期步骤是:" + expect_step if expect_step != '': expect_result = getattr(action_method, expect_step) result = expect_result(expect_element) print result if result: case_data.write_value(i, "pass") print "------------------pass--------------------" else: case_data.write_value(i, "fail") print "------------------fail--------------------"
def run_method(self): server = Server() server.main() data = GetData() action_method = ActionMethod() lines = data.get_case_lines() for i in range(1, lines): handle_step = data.get_handle_step(i) element_key = data.get_element_key(i) handle_value = data.get_handle_value(i) expect_key = data.get_expect_element(i) expect_step = data.get_expect_handle(i) #input() login_button #input str #None excute_method = getattr(action_method, handle_step) if element_key != None: excute_method(element_key, handle_value) else: excute_method(handle_value) if expect_step != None: expect_result = getattr(action_method, expect_step) result = expect_result(expect_key) if result: data.write_value(i, "passs") else: data.write_value(i, "fail")
def run_method(self): # 启动appium服务 server = Server() server.main() # 生成Server data = GetData() action_method = ActionMethod() lines = data.get_case_lines() time.sleep(5) for i in range(1, lines): handle_step = data.get_handle_step(i) element_key = data.get_element_key(i) handle_value = data.get_handle_value(i) expect_key = data.get_expect_element(i) expect_step = data.get_expect_handle(i) excute_method = getattr(action_method, handle_step) if element_key != None: excute_method(element_key, handle_value) else: excute_method(handle_value) if expect_step != None: expect_result = getattr(action_method, expect_step) expect_result(expect_key)
class RunMain: def __init__(self): self.server = Server() self.server.main() base_driver = BaseDriver() self.driver = base_driver.android_driver(0) self.data = GetData() self.lines = self.data.get_case_lines() def operate_page(self, i): operate_page = self.data.get_operate_page(i) action_method = ActionMethod(operate_page, self.driver) return action_method def run_method(self): for i in range(1, self.lines): operate_page = self.operate_page(i) handle_step = self.data.get_handle_step(i) element_key = self.data.get_element_key(i) handle_value = self.data.get_handle_value(i) expect_element = self.data.get_expect_element(i) expect_step = self.data.get_expect_handle(i) excute_method = getattr(operate_page, handle_step) # excute_method是一个对象,加括号才被执行 if element_key is not None: excute_method(element_key, handle_value) else: excute_method(handle_value) if expect_step is not None: expect_result = getattr(operate_page, expect_step) result = expect_result(expect_element) if result is not None: self.data.write_value(i, "PASS") else: self.data.write_value(i, "FAIL")
def appium_init(): server = Server() server.main()
def run_all_case(user_num): case_path = os.path.join(cur_path, 'case') report_path = os.path.join(cur_path, 'report') print(report_path) nowTime = datetime.datetime.now().strftime('%Y_%m_%d_%H_%M_%S') print(nowTime) #command = 'pytest {} --userNum={} --html={}\\{}.html --self-contained-html'.format(case_path, user_num, report_path, nowTime) command = 'pytest {case_path} --userNum={user_num} --html=./report/Phone{user_num}_{nowTime}.html --self-contained-html'.format( case_path=case_path, user_num=user_num, nowTime=nowTime) print(command) cmd.excute_cmd(command) if __name__ == '__main__': server = Server() server.main() process = [] for user_num in range(get_count()): print(user_num) p = multiprocessing.Process(target=run_all_case, args=(user_num, )) process.append(p) for p in process: p.start() for p in process: p.join() server.kill_server()
def __init__(self, i): server = Server() server.main() time.sleep(20) #等待appium完全启动 self.action_method = ActionMethod(i)
def appium_init(): server = Server() server.main() time.sleep(20)
def appium_init(): server = Server() server.main("parents")
def appium_init(): #启动appium server = Server() server.main()
def appium_init(): server = Server() server.main("teacher")
def appium_init(): """ 启动appium服务 """ server = Server() server.main() #启动appium服务
def __init__(self): server = Server() server.main() time.sleep(20) operaterYaml = OperateYaml() self.deivces_num = operaterYaml.get_cloumn()
def appium_server(): server = Server() server.main()