def setUp(self): #pd_conn = PD_Connection('172.24.23.111', '8080') #self.driver = self.pd_client_browser = pd_conn.start() Basejob.setUp(self) self.verificationErrors = [] self.accept_next_alert = True self.registerLicUI = Common.RegisterLicUI.RegisterLicUI(self.driver) expect_title = u"产品激活" current_title = self.registerLicUI.get_current_title() logging.info("Current title is " + current_title) # 确认页面标题是“产品激活”, 如果不是退出该用例测试 if not expect_title in current_title: self.driver.quit() self.assertTrue(False) self.assertIn(expect_title, current_title) self.response_msg = self.registerLicUI.get_response_msg_elm() logging.debug("Set up the log system") logfile_prefix = self._testMethodName logging.debug("Testcase name is " + logfile_prefix) testcasedir = os.path.join(RESULT_DIR, logfile_prefix) if not os.path.isdir(testcasedir): os.mkdir(testcasedir) infolog_file = logfile_prefix + '.info' debuglog_file = logfile_prefix + '.debug' # set log files infolog_file = os.path.join(testcasedir, infolog_file) infolvl_handler = logging.FileHandler(infolog_file, "w") fmt = logging.Formatter('[%(levelname)s:%(asctime)s]:%(message)s') infolvl_handler.setFormatter(fmt) infolvl_handler.setLevel(logging.INFO) logging.root.addHandler(infolvl_handler) debuglog_file = os.path.join(testcasedir, debuglog_file) debuglvl_handler = logging.FileHandler(debuglog_file, "w") fmt = logging.Formatter('[%(levelname)s:%(asctime)s]:%(message)s') debuglvl_handler.setFormatter(fmt) debuglvl_handler.setLevel(logging.DEBUG) logging.root.addHandler(debuglvl_handler)
def setUp(self): # 继承父类Basejob,调用环境设置过程 # 设置了日志输出文件接口:PD_DebugLog.xxx # 浏览器对象使用self.driver PD_DebugLog.info_print("Call the parent method setUp") Basejob.setUp(self)
def __init__(self, methodName, need_config=False): Basejob.__init__(self, methodName, need_config) self.pd_browser_main_map = None self.pd_client_browser = None
def __init__(self, methodName, need_config=True): Basejob.__init__(self, methodName, need_config)
def setUp(self): Basejob.setUp(self)
def tearDown(self): Basejob.tearDown(self) self.assertEqual([], self.verificationErrors)