示例#1
0
 def test_A01_DistributionlineMeasDayEnter(self):
     '''登录并录入配线、配变日运行数据'''
     try:
         Loginrun = Login(self.driver)
         ReturnMsg = Loginrun.Login_Function(self.LoginMsg['username'],
                                             self.LoginMsg['password'])
         time.sleep(3)
         self.ReportLog.info_log("登录用户名:%s 密码:%s返回结果:%s" %
                                 (self.LoginMsg['username'],
                                  self.LoginMsg['password'], ReturnMsg))
         if 'lj' == ReturnMsg:
             self.ReportLog.info_log(u'登录成功!')
         else:
             self.ReportLog.info_log(u'登录失败!')
         self.DistributionlineDayData = self.DataEnter[
             'DistributionlineDayData'].split(",")
         self.DistributionTransformDayData = self.DataEnter[
             'DistributionTransformDayData'].split(",")
         DataEnterrun = DistributionlineMeasDayEnter(self.driver)
         self.ReturnMsg1 = DataEnterrun.DistributionlineMeasDayEnter_Fun(
             self.DistributionlineDayData,
             self.DistributionTransformDayData)
         if self.EnterMsgDayT == self.ReturnMsg1:
             self.ReportLog.info_log(u'未修改输入数据,请确认数据是否为正确的数据')
         else:
             self.ReportLog.info_log(u'录入数据成功')
     except Exception, e:
         self.ReportLog.error_log(e)
         GetCapture.GetCapture(self.driver)
         self.ReportLog.error_log(u"数据无法正确保存")
         raise e
示例#2
0
 def test_A11_DistributionlineComAHlTraDay(self):
     '''配线综合分析-变压器损耗电量追溯结果报表核对'''
     try:
         Loginrun = Login(self.driver)
         ReturnMsg = Loginrun.Login_Function(self.LoginMsg['username'],
                                             self.LoginMsg['password'])
         time.sleep(3)
         self.ReportLog.info_log("登录用户名:%s 密码:%s返回结果:%s" %
                                 (self.LoginMsg['username'],
                                  self.LoginMsg['password'], ReturnMsg))
         if 'lj' == ReturnMsg:
             self.ReportLog.info_log(u'登录成功!')
         else:
             self.ReportLog.info_log(u'登录失败!')
         FlowCalcResult = DistributionlineComAHlTraDay(self.driver)
         self.ReturnMsg = FlowCalcResult.DistributionlineComAHlTraDay_Fun()
         time.sleep(6)
         self.sheetname = u'配电网高损配变分析报表(日)'
         self.Excel = ExcelToDict.ExcelData(self.filepath8, self.sheetname)
         self.Excel_Data = self.Excel.readExcel()
         self.assertEqual(self.Excel_Data, self.ReturnMsg)
         self.ReportLog.info_log(u'数据校验成功!')
         #print self.Excel_Data
         #print self.ReturnMsg
     except Exception, e:
         self.ReportLog.error_log(e)
         GetCapture.GetCapture(self.driver)
         self.ReportLog.error_log(u"数据校验错误,请检查!")
         raise e
示例#3
0
 def test_A18_DistributionlinePieSSubDay(self):
     '''配电线路线损率分段变电站追溯统计结果核对'''
     try:
         Loginrun = Login(self.driver)
         ReturnMsg = Loginrun.Login_Function(self.LoginMsg['username'],
                                             self.LoginMsg['password'])
         time.sleep(3)
         self.ReportLog.info_log("登录用户名:%s 密码:%s返回结果:%s" %
                                 (self.LoginMsg['username'],
                                  self.LoginMsg['password'], ReturnMsg))
         if 'lj' == ReturnMsg:
             self.ReportLog.info_log(u'登录成功!')
         else:
             self.ReportLog.info_log(u'登录失败!')
         FlowCalcResult = DistributionlinePieSSubDay(self.driver)
         self.ReturnMsg = FlowCalcResult.DistributionlinePieSSubDay_Fun()
         time.sleep(5)
         self.sheetname = u'Sheet1'
         self.Excel = ExcelToDict.ExcelData(self.filepath15, self.sheetname)
         self.Excel_Data = self.Excel.readExcel()
         self.assertEqual(self.Excel_Data, self.ReturnMsg)
         self.ReportLog.info_log(u'数据校验成功!')
         #print self.Excel_Data
         #print self.ReturnMsg
     except Exception, e:
         self.ReportLog.error_log(e)
         GetCapture.GetCapture(self.driver)
         self.ReportLog.error_log(u"数据校验错误,请检查!")
         raise e
示例#4
0
 def test_A06_DistTransformerFlowDayCalcResult(self):
     '''潮流精确算法配电变压器损耗结果验证'''
     try:
         Loginrun = Login(self.driver)
         ReturnMsg = Loginrun.Login_Function(self.LoginMsg['username'],
                                             self.LoginMsg['password'])
         time.sleep(3)
         self.ReportLog.info_log("登录用户名:%s 密码:%s返回结果:%s" %
                                 (self.LoginMsg['username'],
                                  self.LoginMsg['password'], ReturnMsg))
         if 'lj' == ReturnMsg:
             self.ReportLog.info_log(u'登录成功!')
         else:
             self.ReportLog.info_log(u'登录失败!')
         FlowCalcResult = DistTransformerFlowDayCalcResult(self.driver)
         self.ReturnMsg = FlowCalcResult.DistTransformerFlowDayCalcResult_Fun(
         )
         time.sleep(5)
         self.sheetname = u'配电变压器损耗报表(24点)'
         self.Excel = ExcelToDict.ExcelData(self.filepath3, self.sheetname)
         self.Excel_Data = self.Excel.readExcel()
         self.assertEqual(self.Excel_Data, self.ReturnMsg)
         self.ReportLog.info_log(u'数据校验成功!')
         #print self.Excel_Data
         #print self.ReturnMsg
     except Exception, e:
         self.ReportLog.error_log(e)
         GetCapture.GetCapture(self.driver)
         self.ReportLog.error_log(u"数据校验错误,请检查!")
         raise e
示例#5
0
 def test_A03_DistributionlineFlowDayCalc(self):
     '''配电线路潮流精确算法计算'''
     try:
         Loginrun = Login(self.driver)
         ReturnMsg = Loginrun.Login_Function(self.LoginMsg['username'],
                                             self.LoginMsg['password'])
         time.sleep(3)
         self.ReportLog.info_log("登录用户名:%s 密码:%s返回结果:%s" %
                                 (self.LoginMsg['username'],
                                  self.LoginMsg['password'], ReturnMsg))
         if 'lj' == ReturnMsg:
             self.ReportLog.info_log(u'登录成功!')
         else:
             self.ReportLog.info_log(u'登录失败!')
         FlowCalc = DistributionlineFlowDayCalc(self.driver)
         self.ReturnMsg = FlowCalc.DistributionlineFlowDayCalc_Fun()
         if u'是否要打开当前配线的计算结果?' == self.ReturnMsg:
             self.ReportLog.info_log(u'计算成功!')
         else:
             self.ReportLog.info_log(u'计算失败!')
     except Exception, e:
         self.ReportLog.error_log(e)
         GetCapture.GetCapture(self.driver)
         self.ReportLog.error_log(u"计算失败!")
         raise e
示例#6
0
 def test_A1_WholelossMeasHourEnter(self):
     #登录并录入运行数据
     try:
         Loginrun = Login(self.driver)
         ReturnMsg = Loginrun.Login_Function(self.LoginMsg['username'],
                                             self.LoginMsg['password'])
         self.ReportLog.info_log("登录用户名:%s 密码:%s 返回结果:%s" %
                                 (self.LoginMsg['username'],
                                  self.LoginMsg['password'], ReturnMsg))
         if 'lj' == ReturnMsg:
             self.ReportLog.info_log('登录成功')
         else:
             self.ReportLog.info_log('登录失败')
         WholelEnterRun = WholelossMeasHourEnter(self.driver)
         self.EnterReturnMsg = WholelEnterRun.WholelossMeasHourEnter_Fun(
             self.DataEnter['Args'])
         print self.EnterMsgT
         print self.EnterReturnMsg
         if self.EnterMsgT == self.EnterReturnMsg:
             self.ReportLog.info_log('未修改输入数据,请确认数据是否为正确的数据')
         else:
             self.ReportLog.info_log('录入数据成功')
     except Exception, e:
         self.ReportLog.info_log(e)
         GetCapture.GetCapture(self.driver)
         self.ReportLog.error_log("数据无法保存!")
         raise e
示例#7
0
 def test_A5_TranotherlossmonCalcResult(self):
     #登录并查看月其他损耗表
     try:
         Loginrun = Login(self.driver)
         ReturnMsg = Loginrun.Login_Function(self.LoginMsg['username'],
                                             self.LoginMsg['password'])
         self.ReportLog.info_log("登录用户名:%s 密码:%s 返回结果:%s" %
                                 (self.LoginMsg['username'],
                                  self.LoginMsg['password'], ReturnMsg))
         if 'lj' == ReturnMsg:
             self.ReportLog.info_log('登录成功!')
         else:
             self.ReportLog.info_log('登录失败!')
         OtherResuslt = TranotherlossmonCalcResult(self.driver)
         self.OtherResusltMsg = OtherResuslt.TranotherlossmonCalcResult_Fun(
         )
         time.sleep(5)
         self.sheetname = u'输电网其他损耗报表(月)'
         self.Excel = ExcelToDict.ExcelData(self.filepath3, self.sheetname)
         self.Excel_Data = self.Excel.readExcel()
         self.assertEqual(self.Excel_Data, self.OtherResusltMsg)
         #self.ReportLog.info_log("返回的计算结果%s"%self.OtherResusltMsg)
         self.ReportLog.info_log('数据校验成功!')
     except Exception, e:
         self.ReportLog.info_log(e)
         GetCapture.GetCapture(self.driver)
         self.ReportLog.error_log("数据校验错误,请检查!")
         raise e
示例#8
0
 def test_A2_WholelossNiuhourcalc(self):
     #登录并计算
     try:
         Loginrun = Login(self.driver)
         ReturnMsg = Loginrun.Login_Function(self.LoginMsg['username'],
                                             self.LoginMsg['password'])
         self.ReportLog.info_log("登录用户名:%s 密码:%s 返回结果:%s" %
                                 (self.LoginMsg['username'],
                                  self.LoginMsg['password'], ReturnMsg))
         if 'lj' == ReturnMsg:
             self.ReportLog.info_log('登录成功')
         else:
             self.ReportLog.info_log('登录失败')
         WholeCalc = WholelossNiuhourcal(self.driver)
         self.WholeCalcMsg = WholeCalc.WholelossNiuhourcal_Fun()
         if u'是否要打开当前全网总损耗?' == self.WholeCalcMsg:
             self.ReportLog.info_log('计算成功!')
         else:
             self.ReportLog.info_log('计算失败!')
     except Exception, e:
         self.ReportLog.info_log(e)
         GetCapture.GetCapture(self.driver)
         self.ReportLog.error_log("计算失败,请检查!")
         raise e
示例#9
0
        self.driver.find_element_by_xpath(
            self.DistributionLineMonthlyReport_Xpath).click()
        time.sleep(1)
        # 点击配电线路线损表
        self.driver.find_element_by_xpath(
            self.LinelossmeterDistributionline_Xpath).click()
        time.sleep(1)
        # 切换frame到配电线路线损表frame
        self.driver.switch_to.frame(self.DistributionLineCalcResult_frame)
        time.sleep(1)
        # 点击左下方的导出按钮
        self.driver.find_element_by_id(self.Export_id).click()
        time.sleep(10)
        #读取导出文件execl内容,生成列表返回
        self.ExportExecl = ExcelData(
            u"C:\\Users\\" + GetUsername() + u"\\Downloads\\配电线路损耗报表(月).xls",
            u"配电线路损耗报表(月)")
        return self.ExportExecl.readExcel()


if __name__ == "__main__":
    try:
        driver = webdriver.Chrome()
        LoginRun = Login(driver)
        LoginRun.Login_Function("Autotest", "000000")
        Try = DistributionlineVoluMonthCalcResult(driver)
        result = Try.DistributionlineVoluMonthCalcResult_Fun()
        print result

    finally:
        driver.quit()