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
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
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
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
#点击月报表 driver.find_element_by_xpath( "//*[@id = 'Lltmenu-panel-body']/div/table/tbody/tr[6]/td/div/img[2]" ).click() time.sleep(1) #点击配电线路线损表 driver.find_element_by_xpath( "//*[@id = 'Lltmenu-panel-body']/div/table/tbody/tr[7]/td/div").click( ) time.sleep(1) #切换frame到配电线路线损表frame driver.switch_to.frame("iframe_297efe173ab9e771013aba8af15d000a") time.sleep(1) #点击左下方的导出按钮 driver.find_element_by_id("button-1083-btnIconEl").click() time.sleep(10) ExportExecl = ExcelToDict.ExcelData( u"C:\\Users\\Administrator\\Downloads\\配电线路损耗报表(月).xls", u"配电线路损耗报表(月)") TargetExeclPath = GetProjectFilePath.GetProjectFilePath( ) + u"\\EagleProjecttest\\Data\\配电线路容量法损耗报表(月).xls" TargetExecl = ExcelToDict.ExcelData(TargetExeclPath, u"配电线路损耗报表(月)") CmpResult = cmp(TargetExecl.readExcel(), ExportExecl.readExcel()) print CmpResult except Exception, e: print e finally: time.sleep(10) driver.quit()