class LoadVideoLogin(unittest.TestCase): """登录上传视频的正反例""" def setUp(self): self.dr = BaseDriver().getdriver() self.c = Commonlib(self.dr) self.b = LoadVideoBussiness(self.dr) def tearDown(self): self.c.wait_time(2) self.c.quit_broswer() @parameterized.expand(bulid_data) def test_load_video_login(self, username, pwd, expect, is_sucess): """登录成功拿到页面文字' 视频管理',登录失败停留在登录页面拿到文字‘声像情报分析系统’""" try: LoggIn.logg_out("准备登录上传视频登录页面") self.b.loadvideologin(username, pwd) if is_sucess: textsucess = self.b.loginhandle.log_sucess_text() print("登录成功后断言为------>%s" % textsucess) return textsucess #断言,"视频管理" self.assertEqual(textsucess, expect) else: # textfail = self.busi_loadvd_login.loginhandle.login_fail_text() textfail = self.b.loginhandle.login_fail_text() print("登录失败后停留在登录页面断言为---->%s" % textfail) self.assertEqual(textfail, expect) return textfail #断言 “声像情报分析系统” except Exception as e: self.c.get_screen_shot("test_load_video_login") print(e)
class PersonsBank(unittest.TestCase): """登录系统切换到人物库""" def setUp(self) -> None: self.lo = LoggIn() driver = BaseDriver().getdriver() self.c = Commonlib(driver) self.c.solv_log_waring() self.pbb = PersonsBankBusiness(driver) self.lob = LoginBussiness(driver) def tearDown(self) -> None: pass @parameterized.expand(bulid_data) def test_person_colum(self,username,pwd,expect,is_sucess): try: if is_sucess: text_list = [] self.lob.logoin(username,pwd) self.pbb.person_index() famous_text = self.pbb.pbh.get_famouspersion_text() text_list.append(famous_text) unknow_text = self.pbb.pbh.get_unknownpersion_text() text_list.append(unknow_text) print("生成列表为---->%s"%text_list) self.assertEqual(text_list,expect) return text_list except Exception as e: self.lo.logg_out(e) self.c.get_screen_shot("test_person_colum")
class SearchFamousPersonsInfo(unittest.TestCase): """名人详细信息""" def setUp(self) -> None: self.lo = LoggIn() driver = BaseDriver.getdriver() self.c = Commonlib(driver) self.c.solv_log_waring() self.pbb = PersonsBankBusiness(driver) self.lgin = LoginBussiness(driver) def tearDown(self) -> None: pass @parameterized.expand(bulid_data) def test_get_famousperson_info(self, username, pwd, value, is_sucess): """拿到著名人物的信息""" try: self.lgin.logoin(username, pwd) self.pbb.search_name_person(value) if is_sucess: search_list = [] search_name = self.pbb.pbh.get_famoussion_name_text() search_list.append(search_name) search_china_name = self.pbb.pbh.get_china_name_text() search_list.append(search_china_name) search_foreign_name = self.pbb.pbh.get_forgin_name_text() search_list.append(search_foreign_name) search_gender = self.pbb.pbh.get_famous_gender_text() search_list.append(search_gender) search_nation = self.pbb.pbh.get_famous_nation_text() search_list.append(search_nation) search_party = self.pbb.pbh.get_famous_party_text() search_list.append(search_party) search_university = self.pbb.pbh.get_university_name_text() search_list.append(search_university) search_homeaddr = self.pbb.pbh.get_homeaddres_text() search_list.append(search_homeaddr) search_persion = self.pbb.pbh.get_position_text() search_list.append(search_persion) # self.assertEqual(expect,search_list) print("输入搜索值为---->%s,搜索到结果为%s" % (value, search_list)) else: error_info = self.pbb.pbh.get_send_errorkeywords_text() print("输入搜索值---->%s后搜索到结果为--->%s" % (value, error_info)) except Exception as e: self.lo.logg_out(e) self.c.get_screen_shot("test_get_famousperson_info")
class YinShiPinTest(unittest.TestCase): """点击音视频栏目,拿到下面子栏目的title""" def setUp(self) -> None: self.lo = LoggIn() driver = BaseDriver().getdriver() self.c = Commonlib(driver) self.c.solv_log_waring() self.b = YinShiPinBusiness(driver) def tearDown(self) -> None: self.c.wait_time(2) self.c.quit_broswer() @parameterized.expand(bulid_data) def test_yinshi_colum(self, username, pwd, expect, is_sucess): """拿到音视频下的子栏目的三个值""" try: if is_sucess: titlelist = [] self.b.yin_shipin_index(username, pwd) text_shishiredian = self.b.yinsp.text_shisrd_title() titlelist.append(text_shishiredian) text_neiwangzibian = self.b.yinsp.text_neiwzb_title() titlelist.append(text_neiwangzibian) text_waiwangziyuan = self.b.yinsp.text_waiwang_title() titlelist.append(text_waiwangziyuan) text_guanzhu = self.b.yinsp.text_wodeguanzhu_title() titlelist.append(text_guanzhu) self.assertEqual(titlelist, expect) print("点击音视频库后下子栏目为---->%s" % titlelist) return titlelist except Exception as e: self.lo.logg_out(e) self.c.get_screen_shot("test_yinshi_colum")
class LoginTest(unittest.TestCase): """登录测试案例正例反例""" def setUp(self) -> None: self.dr = BaseDriver().getdriver() self.common = Commonlib(self.dr) self.lo = LoggIn() self.lo.logg_out("------------->打开浏览器运行--%s--这个类" % LoginTest) self.common.solv_log_waring() self.businesslogin = LoginBussiness(self.dr) def tearDown(self) -> None: self.common.wait_time(5) self.common.quit_broswer() self.lo.logg_out(">-----------关闭浏览器") @parameterized.expand(bulid_data) def test_login(self, username, pwd, expect, is_sucess): """登录"知音晓视"正例和反例 登录成功,拿到"声像情报融合分析平台",不成功则停留在主页 '声像情报分析系统'""" try: self.businesslogin.logoin(username, pwd) if is_sucess: """登录成功就返回主页信息""" text = self.businesslogin.loghandle.login_sucess_text() self.lo.logg_out("登录成功后进入主页面,主页面标题为---->%s" % text) print("登录成功后进入主页面,主页面标题为---->%s" % text) self.assertEqual(text, expect) return text #断言 "声像情报融合分析平台" else: # """登录失败,就停在登录主页""" texttwo = self.businesslogin.loghandle.login_fail_text() self.lo.logg_out("密码错误登录失败停留在登录页面文字为--->%s" % texttwo) print("密码错误登录失败停留在登录页面文字为--->%s" % texttwo) self.assertEqual(texttwo, expect) return texttwo #断言 "声像情报分析系统" except Exception as e: self.common.get_screen_shot("test_login")