class PerTest_INITENV(TestCase): ''' 初始化整个测试环境 创建driver,整个项目共用的driver 获取启动完成时间 启动性能采集apk 关闭页面上的系统弹框和活动页面 ''' owner = "LucyLiu" status = EnumStatus.Design priority = EnumPriority.High timeout = 5 def run_test(self): print "PerTest_INITENV**************" self.common = Common() self.common.platformLog("PerTest_INITENV 初始化整个测试环境") self.common.setupdriver() self.common.deletefile() self.common.getResumeTime() self.common.startCollectApp() self.common.closeactivity() mid = self.common.get_mid()
class TestCase_Initialize(TestCase): ''' 用例初始化 ''' owner = "LucyLiu" status = EnumStatus.Design priority = EnumPriority.High timeout = 5 def pre_test(self): self.common = Common() self.hall_page = Hall_Page() self.start_step("初始化Luadriver") self.luadriver = self.common.setupdriver() self.common.closeactivity() # self.common.user_money(money=5000) def run_test(self): ''' 测试用例 ''' self.hall_page.wait_element("同步标志") # env = self.common.get_config_value('casecfg', 'env') self.start_step("获取mid") mid = self.common.get_mid() self.common.set_config_value("casecfg", "mid", str(mid)) print self.common.get_config_value("casecfg", "mid") # if env == '1': # self.common.recover_user(str(mid)) # else: # self.log_info("当前环境非测试环境") def post_test(self): ''' 测试用例执行完成后,清理测试环境 ''' self.common.closedriver()