示例#1
0
 def write_valid_result():
     global row
     ExcelUtil.write_data(path, PropertyFile.getValues('salestd'), row, 6,
                          "Record Created Successfully")
     ExcelUtil.write_data(path, PropertyFile.getValues('salestd'), row, 7,
                          'Pass')
     row = row + 7
示例#2
0
class TestData:
    BASE_URL = PropertyFile.getValues('url')
    USERNAME = PropertyFile.getValues('username')
    PASSWORD = PropertyFile.getValues('password')

    @staticmethod
    def getCustomerInformationTestData():
        dataList = []
        filePath = path
        testSheet = PropertyFile.getValues('sheet')

        rowCount = ExcelUtil.get_rowcount(filePath, testSheet)
        for i in range(7, rowCount + 1, 6):  # to get rows
            Dict = {}
            Dict['firstname'] = ExcelUtil.read_data(filePath, testSheet, i+1, 4)
            Dict['lastname'] = ExcelUtil.read_data(filePath, testSheet, i + 2, 4)
            Dict['postalcode'] = ExcelUtil.read_data(filePath, testSheet, i + 3, 4)
            print(Dict)

            dataList.append(Dict)
        return dataList

    @staticmethod
    def write_valid_result():
        global row
        expected = ExcelUtil.read_data(path, PropertyFile.getValues('sheet'), row, 5)

        ExcelUtil.write_data(path,
                             PropertyFile.getValues('sheet'), row, 6,
                             "successful")
        if expected == "successful":
            ExcelUtil.write_data(path,
                                 PropertyFile.getValues('sheet'), row, 7,
                                 'Pass')
        else:
            ExcelUtil.write_data(path,
                                 PropertyFile.getValues('sheet'), row, 7,
                                 'Fail')
        row = row + 6

    @staticmethod
    def write_invalid_result():
        global row
        expected = ExcelUtil.read_data(path,PropertyFile.getValues('sheet'), row, 5)

        ExcelUtil.write_data(path,
                             PropertyFile.getValues('sheet'), row, 6,
                             "unsuccessful")
        if expected == "unsuccessful":
            ExcelUtil.write_data(path,
                                 PropertyFile.getValues('sheet'), row, 7,
                                 'Pass')
        else:
            ExcelUtil.write_data(path,
                                 PropertyFile.getValues('sheet'), row, 7,
                                 'Fail')

        row = row + 6
示例#3
0
 def write_invalid_result():
     global row
     expected = ExcelUtil.read_data(path, PropertyFile.getValues('salestd'),
                                    row, 5)
     if "should not be" in expected:
         expected = expected.replace('should not be', 'is not')
     ExcelUtil.write_data(path, PropertyFile.getValues('salestd'), row, 6,
                          expected)
     ExcelUtil.write_data(path, PropertyFile.getValues('salestd'), row, 7,
                          'Pass')
     row = row + 7
示例#4
0
class TestData:
    BASE_URL = PropertyFile.getValues('url')
    USERNAME = PropertyFile.getValues('username')
    PASSWORD = PropertyFile.getValues('password')

    @staticmethod
    def getSalesTestData():
        dataList = []
        filePath = path
        testSheet = PropertyFile.getValues('salestd')

        rowCount = ExcelUtil.get_rowcount(filePath, testSheet)
        for i in range(7, rowCount + 1, 7):  # to get rows
            Dict = {}
            Dict['customername'] = ExcelUtil.read_data(filePath, testSheet, i,
                                                       4)
            Dict['validity'] = ExcelUtil.read_data(filePath, testSheet, i + 1,
                                                   4)
            Dict['product1'] = ExcelUtil.read_data(filePath, testSheet, i + 2,
                                                   4)
            Dict['product2'] = ExcelUtil.read_data(filePath, testSheet, i + 3,
                                                   4)
            Dict['product3'] = ExcelUtil.read_data(filePath, testSheet, i + 4,
                                                   4)
            Dict['paymentterms'] = ExcelUtil.read_data(filePath, testSheet,
                                                       i + 5, 4)
            Dict['downpayment'] = ExcelUtil.read_data(filePath, testSheet,
                                                      i + 6, 4)
            dataList.append(Dict)
        return dataList

    @staticmethod
    def write_valid_result():
        global row
        ExcelUtil.write_data(path, PropertyFile.getValues('salestd'), row, 6,
                             "Record Created Successfully")
        ExcelUtil.write_data(path, PropertyFile.getValues('salestd'), row, 7,
                             'Pass')
        row = row + 7

    @staticmethod
    def write_invalid_result():
        global row
        expected = ExcelUtil.read_data(path, PropertyFile.getValues('salestd'),
                                       row, 5)
        if "should not be" in expected:
            expected = expected.replace('should not be', 'is not')
        ExcelUtil.write_data(path, PropertyFile.getValues('salestd'), row, 6,
                             expected)
        ExcelUtil.write_data(path, PropertyFile.getValues('salestd'), row, 7,
                             'Pass')
        row = row + 7
示例#5
0
    def write_valid_result():
        global row
        expected = ExcelUtil.read_data(path, PropertyFile.getValues('sheet'), row, 5)

        ExcelUtil.write_data(path,
                             PropertyFile.getValues('sheet'), row, 6,
                             "successful")
        if expected == "successful":
            ExcelUtil.write_data(path,
                                 PropertyFile.getValues('sheet'), row, 7,
                                 'Pass')
        else:
            ExcelUtil.write_data(path,
                                 PropertyFile.getValues('sheet'), row, 7,
                                 'Fail')
        row = row + 6
示例#6
0
    def getCustomerInformationTestData():
        dataList = []
        filePath = path
        testSheet = PropertyFile.getValues('sheet')

        rowCount = ExcelUtil.get_rowcount(filePath, testSheet)
        for i in range(7, rowCount + 1, 6):  # to get rows
            Dict = {}
            Dict['firstname'] = ExcelUtil.read_data(filePath, testSheet, i+1, 4)
            Dict['lastname'] = ExcelUtil.read_data(filePath, testSheet, i + 2, 4)
            Dict['postalcode'] = ExcelUtil.read_data(filePath, testSheet, i + 3, 4)
            print(Dict)

            dataList.append(Dict)
        return dataList
示例#7
0
    def getSalesTestData():
        dataList = []
        filePath = path
        testSheet = PropertyFile.getValues('salestd')

        rowCount = ExcelUtil.get_rowcount(filePath, testSheet)
        for i in range(7, rowCount + 1, 7):  # to get rows
            Dict = {}
            Dict['customername'] = ExcelUtil.read_data(filePath, testSheet, i,
                                                       4)
            Dict['validity'] = ExcelUtil.read_data(filePath, testSheet, i + 1,
                                                   4)
            Dict['product1'] = ExcelUtil.read_data(filePath, testSheet, i + 2,
                                                   4)
            Dict['product2'] = ExcelUtil.read_data(filePath, testSheet, i + 3,
                                                   4)
            Dict['product3'] = ExcelUtil.read_data(filePath, testSheet, i + 4,
                                                   4)
            Dict['paymentterms'] = ExcelUtil.read_data(filePath, testSheet,
                                                       i + 5, 4)
            Dict['downpayment'] = ExcelUtil.read_data(filePath, testSheet,
                                                      i + 6, 4)
            dataList.append(Dict)
        return dataList
示例#8
0
from win32com import client

excel = client.Dispatch(dispatch="Excel.Application")
wb = excel.Workbooks.Add()

today = datetime.date.today()
d1 = today.strftime("%d-%m-%Y")
t = time.localtime()
ctime = time.strftime("%H:%M:%S", t).replace(":", "_")
path = os.path.join(os.getcwd(), f'excel-report\\Ecommerce_Test_Data-{d1}_{ctime}.xlsx')
wb.SaveAs(path)
excel.Application.Quit()

xl = client.Dispatch("Excel.Application")
# xl.Visible = True  # You can remove this line if you don't want the Excel application to be visible
originalFilePath = os.path.join(os.getcwd(), PropertyFile.getValues('excelFilePath'))
wb1 = xl.Workbooks.Open(Filename=originalFilePath)

wb2 = xl.Workbooks.Open(
    Filename=path)

ws1 = wb1.Worksheets(1)
ws1.Copy(Before=wb2.Worksheets(1))

wb2.Close(SaveChanges=True)
xl.Quit()

row = 7


class TestData:
示例#9
0
excel = client.Dispatch(dispatch="Excel.Application")
wb = excel.Workbooks.Add()

today = datetime.date.today()
d1 = today.strftime("%d-%m-%Y")
t = time.localtime()
ctime = time.strftime("%H:%M:%S", t).replace(":", "_")
path = os.path.join(os.getcwd(), f'excel-report\\test_data-{d1}_{ctime}.xlsx')
wb.SaveAs(path)
excel.Application.Quit()

xl = client.Dispatch("Excel.Application")
# xl.Visible = True  # You can remove this line if you don't want the Excel application to be visible
originalFilePath = os.path.join(os.getcwd(),
                                PropertyFile.getValues('excelFilePath'))
wb1 = xl.Workbooks.Open(Filename=originalFilePath)

wb2 = xl.Workbooks.Open(Filename=path)

ws1 = wb1.Worksheets(1)
ws1.Copy(Before=wb2.Worksheets(1))

wb2.Close(SaveChanges=True)
xl.Quit()

row = 7


class TestData:
    BASE_URL = PropertyFile.getValues('url')