Exemplo n.º 1
0
 def __init__ (self, tsFile):
     self.TestStepResultCollection:list = []
     self.TestStateFile = tsFile
     self.settings = Settings.getSettings()
     self.TestStateStartTime = Tool.CurrentTime()
     self.TestStateReportPath:str = self.settings.CurrentScriptResultFolder + '\\' + self.TestStateFile.replace('.xlsx', '.html')
     self.RelativeTestStateReportPath:str = self.settings.CurrentScript + '\\' + self.TestStateFile.replace('.xlsx', '.html')
 def __init__(self):
     self.settings = Settings.getSettings()
     self.StateInfoTemplate = os.getcwd() + '\\TestResult\\StateInfoTemplate.txt'
     self.CaseStateInfoTemplate = os.getcwd() + '\\TestResult\\CaseStateInfoTemplate.txt'
     self.CaseStateInfoReport = self.settings.CurrentTestResultFolder + '\\CaseStateInfoReport.txt'
     self.planInfoHtml = self.settings.CurrentTestResultFolder + '\\' + self.settings.planFile + ".html"
     self.caseSummaryInfoTemplate = os.getcwd() + '\\TestResult\\CaseSummaryInfoTemplate.txt'
     self.caseSummaryInfoReportPath = self.settings.CurrentTestResultFolder + '\\' + "CaseSummaryInfoReport.txt"
Exemplo n.º 3
0
 def __init__(self, testStateRe):
     self.settings = Settings.getSettings()
     self.testStateResult = testStateRe
     self.DetailsInfoTemplate = os.getcwd(
     ) + "\\TestResult\\DetailInfoTemplate.html"
     self.DetailsInfoHtml = self.testStateResult.TestStateReportPath
     self.CaseInfoTemplate = os.getcwd(
     ) + "\\TestResult\\CaseInfoTemplate.txt"
 def setModuleInfo(self):
     self.settings = Settings.getSettings()
     self.moduleScriptCount = self.settings.testPlanResult.moduleInfoCollection[
         self.currentModuleName]
     for testCaseR in self.settings.testPlanResult.TestCaseResultCollection:
         if testCaseR.TestCaseFile.split('\\')[0] == self.currentModuleName:
             if testCaseR.CaseResult == "Passed":
                 self.moduleScriptPassedCount = self.moduleScriptPassedCount + 1
             else:
                 self.moduleScriptFailedCount = self.moduleScriptFailedCount + 1
     self.modulePassPercentage = "width:" + str(
         (self.moduleScriptPassedCount /
          (self.moduleScriptPassedCount + self.moduleScriptFailedCount) *
          100)) + "%"
     self.moduleFailPercentage = "width:" + str(
         (self.moduleScriptFailedCount /
          (self.moduleScriptPassedCount + self.moduleScriptFailedCount) *
          100)) + "%"
Exemplo n.º 5
0
 def setUpClass(cls):
     Settings.constructSettings()
     MainFramework.settings = Settings.getSettings()
     logging.info("construct settings successfully")
Exemplo n.º 6
0
 def __init__(self):
     self.testStepResult = TestStepResult()
     self.settings = Settings.getSettings()
Exemplo n.º 7
0
 def __init__(self):
     self.settings = Settings.getSettings()
     self.planInfoTemplate = os.getcwd(
     ) + "\\TestResult\\PlanInfoTemplate.html"
     self.planInfoHtml = self.settings.CurrentTestResultFolder + '\\' + self.settings.planFile + ".html"
 def setUpClass(cls):
     '''set up before execute test'''
     Settings.constructSettings()
     MainFramework.settings = Settings.getSettings()
     logging.info("construct settings successfully")
    def SetState(self, stateFile):
        self.settings = Settings.getSettings()
        self.testStateResult = TestStateResult(stateFile)
        try:
            wb_state = load_workbook(self.settings.StateFilePath)
            logging.info('open state file: "{0}" successfully'.format(
                self.settings.StateFilePath))
            wk_state_sheet = wb_state['Sheet1']
            testScriptRow: int = wk_state_sheet.max_row - 1
            # Clean last time result
            for i in range(2, testScriptRow + 2):
                wk_state_sheet.cell(i, 7).value = ''
                wk_state_sheet.cell(i, 8).value = 'Not run'
                wk_state_sheet.cell(i, 9).value = ''
            for i in range(2, testScriptRow + 2):
                description = wk_state_sheet.cell(
                    i,
                    1).value if wk_state_sheet.cell(i, 1).value != None else ''
                keyword = wk_state_sheet.cell(
                    i,
                    2).value if wk_state_sheet.cell(i, 2).value != None else ''
                parameter = wk_state_sheet.cell(
                    i,
                    3).value if wk_state_sheet.cell(i, 3).value != None else ''
                objectName = wk_state_sheet.cell(
                    i,
                    4).value if wk_state_sheet.cell(i, 4).value != None else ''
                tagName = wk_state_sheet.cell(
                    i,
                    5).value if wk_state_sheet.cell(i, 5).value != None else ''
                expect = wk_state_sheet.cell(
                    i,
                    6).value if wk_state_sheet.cell(i, 6).value != None else ''
                # execute test step
                obj = None
                if (objectName != None and objectName != '-'
                        and objectName != ''):
                    obj = self.pageObject.getPageObject(objectName)
                if (isinstance(obj, dict)):
                    tagName = list(obj.keys())[0]
                testStepResult: TestStepResult = self._deco(
                    self.keyword_Execute, keyword, obj, parameter)
                logging.info(f'execute "{keyword}" ')
                testStepResult.StepNumber = str(i - 1)
                testStepResult.StepDescription = description
                testStepResult.StepKeyword = keyword
                testStepResult.Expect = '../../../../..' + self.settings.CurrentScriptPath.replace(
                    '.xlsx', '').split('src')[1] + "/Attachment/" + expect
                testStepResult.StepTagName = tagName
                testStepResult.StepParameter = parameter
                testStepResult.StepObject = objectName

                if testStepResult.Actual == None:
                    testStepResult.Actual = ''
                wk_state_sheet.cell(i, 5).value = tagName
                wk_state_sheet.cell(i, 7).value = testStepResult.Actual
                wk_state_sheet.cell(i,
                                    8).value = testStepResult.stepResult.name
                wk_state_sheet.cell(i, 9).value = testStepResult.stepLog
                self.testStateResult.TestStepResultCollection.append(
                    testStepResult)
            # save module file
            self.testStateResult.StateResult = self.TestState_Result(
                self.testStateResult)
            self.testStateResult.setLog()
            return self.testStateResult
        except Exception as e:
            logging.error('there is error: ' + str(e) + '.' +
                          traceback.format_exc())
        finally:
            wb_state.save(self.settings.StateFilePath)
            logging.info('save state file: {0} successfully'.format(
                self.settings.StateFilePath))
 def __init__(self):
     self.settings = Settings.getSettings()
     self.pageObject = PageObject()
Exemplo n.º 11
0
 def __init__(self):
     self.settings = Settings.getSettings()
     self.ModuleInfoTemplatePath = os.getcwd(
     ) + '\\TestResult\\ModuleInfoTemplate.txt'
     self.planInfoHtml = self.settings.CurrentTestResultFolder + '\\' + self.settings.planFile + ".html"