def __init__(self, data_path=test_data_path):
     """
     :param data_path:excel数据存放路径
     """
     self.data_path = data_path
     self.test_data_sheet = ExcelUtils(data_path, 'Sheet1')
     self.test_data = self.test_data_sheet.get_sheet_data_by_dict()
     self.test_data_by_mysql = SqlUtils().get_mysql_test_case_info()
 def __init__(self,
              module_name,
              page_name,
              sheet_name=None,
              element_path=excel_path_value):
     self.element_path = element_path
     self.excel_path = os.path.join(self.element_path, module_name,
                                    page_name + '.xlsx')
     self.excelutils = ExcelUtils(self.excel_path, sheet_name)
Пример #3
0
 def __init__(self,
              test_suite_name,
              test_file_name,
              test_class_name=None,
              test_data_path=test_data_path):
     test_data_path = os.path.join(test_data_path, test_suite_name,
                                   test_file_name + '.xlsx')
     self.excel_data = ExcelUtils(test_data_path,
                                  test_class_name).get_sheet_data_by_list
     self.excel_rows = len(self.excel_data)
Пример #4
0
#!/usr/bin/env python
# encoding: utf-8
# @author:lrh
# @file:取合并单元格的数据
# @time:2020/7/1 21:26
import os
import xlrd
from common.excel_utils import ExcelUtils

current_value = os.path.dirname(__file__)
excel_path = os.path.join(current_value, 'data/testl_data.xlsx')
excelUtils = ExcelUtils(excel_path, "Sheet1")
# print(excelUtils.get_merged_cell_value(8,0))

#自己
# sheet_list = []
# for row in range(1,excelUtils.get_row_count()):
#     dict = {}
#     for col in range(0,excelUtils.get_col_count()):
#         # value = excelUtils.get_merged_cell_value(row,col)
#         dict[excelUtils.get_merged_cell_value(0,col)] =  excelUtils.get_merged_cell_value(row,col)
#     sheet_list.append(dict)

#老师办法
all_data_list = []
first_row = excelUtils.sheet.row(0)
for row in range(1, excelUtils.get_row_count()):
    row_dict = {}
    for col in range(0, excelUtils.get_col_count()):
        row_dict[first_row[col].value] = excelUtils.get_merged_cell_value(
            row, col)
 def __init__(self, data_path=data_path, sheet_name='tag_testcase'):
     self.data_path = data_path
     self.sheet_name = sheet_name
     self.test_data = ExcelUtils(self.data_path, self.sheet_name).get_all_excel_value_by_dict()
Пример #6
0
 def __init__(self,test_data_path = test_data_path):
     self.test_data_path = test_data_path
     self.test_data_sheet = ExcelUtils(test_data_path, "Sheet1")
     self.test_data = self.test_data_sheet.get_sheet_data_by_dict()
     self.test_data_by_mysql = SqlUtils().get_mysql_test_case_info()
Пример #7
0
# !/usr/bin/env python
# encoding: utf-8
# @author: new
# @file: read_excel01.py
# @time: 2020/7/5 9:22
# @desc

import os
import xlrd
from common.excel_utils import ExcelUtils

excel_path = os.path.join(os.path.dirname(__file__), 'data/test_data.xlsx')
print(excel_path)
excel_utils = ExcelUtils(excel_path)
cell_value = excel_utils.get_merged_cell_value(4, 0)
print(cell_value)
#
# sheet_list = []
# for row in range(1, excel_utils.get_raw_count()):
#     row_dict = {}
#     row_dict["事件"] = excel_utils.get_merged_cell_value(row, 0)
#     row_dict["步骤"] = excel_utils.get_merged_cell_value(row, 1)
#     row_dict["步骤操作"] = excel_utils.get_merged_cell_value(row, 2)
#     row_dict["完成情况"] = excel_utils.get_merged_cell_value(row, 3)
#     sheet_list.append(row_dict)

all_data_list = []
first_row = excel_utils.sheet.row(0)
print(first_row)
for row in range(1, excel_utils.get_raw_count()):
    row_dict = {}
Пример #8
0
#!/usr/bin/env python
# encoding: utf-8
# @author: zengzhu
# @file: read_excel.py
# @time: 2020-11-13 23:18
# @desc:
import xlrd3
import os
from common.excel_utils import ExcelUtils
from common.testdata_utils import TestDateUtils

excel_path = os.path.join(os.path.dirname(__file__), 'data/testdata.xlsx')

read_excel = ExcelUtils(excel_path, 'tag_testcase')
all_date = read_excel.get_all_excel_value_by_dict()


dict_01 = {}
for i in all_date:
    dict_01.setdefault(i['测试用例编号'], []).append(i)


listaa = []
for k, v in dict_01.items():
    # print(k)
    # print(v)
    dictb = {}
    dictb['case_name'] = k
    dictb['case_info'] = v
    listaa.append(dictb)
# print(listaa)
 def __init__(self, modul_name, page_name, element_path=None):
     excl_utils = ExcelUtils(modul_name)
     self.element_path = excl_utils.excel_path
     self.page_name = page_name
     self.sheet = excl_utils.sheet_data
     self.nrow = excl_utils.get_row_count
Пример #10
0
 def __init__(self, test_data_path=test_data_file):
     self.test_data_path = test_data_path
     self.test_data = ExcelUtils(
         test_data_path, "Sheet1").get_sheet_data_by_dict()  #获取sheet1的所有数据
Пример #11
0
#!usr/bin/env python
# encoding: utf-8
# @author: cherry
# @file:read_excel_02.py
# @time:2020/7/5 9:23 上午

import os
import xlrd
from common.excel_utils import ExcelUtils
excel_path = os.path.join(os.path.dirname(__file__), 'data/test_data_01.xlsx')

excelUtils = ExcelUtils(excel_path, 'Sheet1')
# print(excelUtils.get_cell_merged_value(4,0))
# 方式一
# sheet_list = []
# for row in range(1,excelUtils.get_row_count()):
#     row_dict = {}
#     row_dict["事件"] = excelUtils.get_cell_merged_value(row,0)
#     row_dict["步骤序号"] = excelUtils.get_cell_merged_value(row, 1)
#     row_dict["步骤操作"] = excelUtils.get_cell_merged_value(row, 2)
#     row_dict["完成情况"] = excelUtils.get_cell_merged_value(row, 3)
#     sheet_list.append(row_dict)
#
# for row in sheet_list:
#     print(row)

# 方式二
alldata_list = []
first_row = excelUtils.sheet.row(0)
print(first_row)
for row in range(1, excelUtils.get_row_count()):
Пример #12
0
 def __init__(self, test_data_path=test_data_path):
     self.test_data_path = test_data_path
     self.test_data_sheet = ExcelUtils(test_data_path, conf.sheet_name)
     self.test_data = self.test_data_sheet.get_sheet_data_by_dict()
Пример #13
0
# encoding: utf-8
#@author: newdream_daliu
#@file: read_test_data.py
#@time: 2020-08-16 17:44
#@desc:
from common.excel_utils import ExcelUtils

file_path = 'D:/P3_PO_UI_Test_Framework/test_datas/test_data_infos.xlsx'
excel_data = ExcelUtils(file_path, 'login_suite').get_sheet_data_by_list()
excel_row = len(excel_data)
test_class_name = 'LoginTest'

# print(excel_data)
# for s in excel_data:
#     print(s)

test_data_infos = {}  #所有的测试用例
for i in range(1, excel_row):
    test_data_info = {}  #一条测试用例的数据
    if excel_data[i][2].__eq__(test_class_name):
        test_data_info['test_name'] = excel_data[i][1]
        # 如果执行用例为是,返回 False,如果不执行就返回True
        test_data_info['isnot'] = False if excel_data[i][3].__eq__(
            '是') else True
        test_data_info['excepted_result'] = excel_data[i][4]
        test_parameter = {}
        for j in range(5, len(excel_data[i])):
            #参数里面包含=号,或者长度大于2,才算一个正常的参数(a=1)
            if excel_data[i][j].__contains__('=') and len(
                    excel_data[i][j]) > 2:
                # username = test01
 def __init__(self, test_suite_name, test_class_name):
     self.test_class_name = test_class_name
     self.excel_data = ExcelUtils(test_data_path,
                                  test_suite_name).get_sheet_data_by_list()
     self.test_suite_counts = len(self.excel_data) - 1
 def __init__(self,test_suite_name,test_calss_name):
     self.test_calss_name=test_calss_name
     self.excel_data=ExcelUtils(excel_path,test_suite_name).get_sheet_data_by_list()
     self.testsuitcounts=len(self.excel_data)  #祛除行首的值
Пример #16
0
 def __init__(self, test_data_path=test_data_path):
     self.test_data_path = test_data_path
     self.test_data = ExcelUtils(test_data_path,
                                 'Sheet1').get_sheet_data_by_dict()
 def __init__(self,test_suite_name,test_file_name,test_class_name,test_data_path=testdata_path):
     self.test_data_path=os.path.join(test_data_path,test_suite_name,test_file_name+'.xls')
     self.test_class_name=test_class_name
     self.excel_data=ExcelUtils(test_class_name,self.test_data_path).get_excel_data_by_list()
     self.excel_rows=len(self.excel_data)
Пример #18
0
 def __init__(self, test_data_path=config.CASE_DATA_PATH):
     self.test_data_path = test_data_path
     self.test_data = ExcelUtils(self.test_data_path,
                                 "Sheet1").get_sheet_data_by_dict()