コード例 #1
0
 def run_main(self):
     self.action_m = ActionMethod()
     read_e = ReadExcel()
     case_lines = read_e.get_lines()
     is_run_col = 3
     if case_lines:
         for i in range(1,case_lines):
             read_e.write_value(i,10,"test")
             # continue
             handle_name = read_e.get_cell(i,2)
             print(handle_name+": ")
             is_run = read_e.get_cell(i,is_run_col)
             print(is_run)
             if is_run == "yes":
                 method = read_e.get_cell(i,4)
                 send_value = read_e.get_cell(i,5)
                 handle_value = read_e.get_cell(i,6)
                 except_result_method = read_e.get_cell(i,7)
                 except_result = read_e.get_cell(i,8)
                 self.run_method(method,send_value,handle_value)
                 if except_result != '':
                     except_value = self.get_excel_result_value(except_result)
                     if except_value[0] == 'text':
                         result = self.run_method(except_result_method)
                         if except_value[1] in result:
                             read_e.write_value(i,9,"pass")
                         else:
                             read_e.write_value(i,9,"fail")
                     elif except_value[0] == 'element':
                         print("except_value[1]:")
                         print(except_value[1])
                         print("except_result:")
                         print(except_result_method)
                         result = self.run_method(except_result_method,except_value[1])
                         if result:
                             read_e.write_value(i,9,"pass")
                         else:
                             read_e.write_value(i,9,"fail")
                     else:
                         print("没有else")
                 else:
                     print("预期结果为空")
コード例 #2
0
 def run_main(self):
     self.action_method = ActionMethod()
     # print(self.action_method)
     handle_excel = ReadExcel('../config/test_case.xls')
     case_lines = handle_excel.get_lines()
     if case_lines:
         for i in range(1, case_lines):
             is_run = handle_excel.get_cell(i, 3)
             # r如果方法执行为yes
             if is_run == 'yes':
                 method = handle_excel.get_cell(i, 4)
                 input_data = handle_excel.get_cell(i, 5)
                 handle_element = handle_excel.get_cell(i, 6)
                 expect_result_method = handle_excel.get_cell(i, 7)
                 expect_result = handle_excel.get_cell(i, 8)
                 self.run_method(method, input_data, handle_element)
                 # 预期结果不等于空
                 if expect_result != '':
                     except_result_value = self.get_expect_result(
                         expect_result)
                     # 获取页面title
                     if except_result_value[0] == 'text':
                         result = self.run_method(expect_result_method)
                         if except_result_value[1] in result:
                             handle_excel.write_value(i, 9, 'pass')
                         else:
                             handle_excel.write_value(i, 9, 'fail')
                     elif except_result_value[0] == 'element':
                         result = self.run_method(expect_result_method,
                                                  except_result_value[1])
                         if result:
                             handle_excel.write_value(i, 9, 'pass')
                         else:
                             handle_excel.write_value(i, 9, 'fail')
                     else:
                         print('除了text和element之外的')
                 else:
                     print('预期结果为空')