Gets the test case
import xlrd from lib.log import atp_log class OpCase(object): def get_case(self,file_path): case = [] if file_path.endswith('.xls') or file_path.endswith('.xlsx'): try: book = xlrd.open_workbook(file_path) Sheet = book.sheet_by_index (0) for I in Range (. 1, sheet.nrows): # EXCLE total number of rows in a ROW_DATA = sheet.row_values (I) # Get the value of each row case.append (row_data [4: 8 ]) # slices (since only remove the standard values 4 to 7 in the subscript) atp_log.info ( ' co read% s regulations with ' % (len (case))) the except Exception aS E: atp_log.error ( ' % s acquisition has failed, an error message with Example% s ' % (file_path, E)) the else : atp_log.error ( ' use cases not legal documents: S% ' % file_path) return Case #测试 #m = OpCase() #m.get_case(r'E:\Users\admin\PycharmProjects\Interface test\ATP') #m.get_case('xx.xls') #m.get_case(r'E:\Users\admin\PycharmProjects\Interface test\ATP\cases\测试用例.xlsx')
send request
def my_request(self,url,method,data): method = method.upper() if method=='POST': requests.get(url,params=data) else: atp_log.warning ( ' the request mode does not support ' )