class TestAudit: # 2.定义初始化方法 def setup_class(self): self.driver = DriverUtils.get_mis_driver() # 定义创建业务方法所在类的对象 self.home_proxy = HomeProxy() self.audit_proxy = AuditProxy() # 3.定义测试方法 def test_audit_artical(self): # 定义测试数据 art_title = PUB_ARTICAL_TITLE # 执行测试步骤 self.home_proxy.to_audit_page() self.audit_proxy.test_audit_art(art_title) # 断言 assert is_exists_element(self.driver,art_title) # 4.定义销毁的方法 def teardown_class(self): time.sleep(3) DriverUtils.quit_mis_driver()
class TestAduit: def setup_class(self): self.driver = DriverUtils.get_mis_driver() self.home_proxy = HomeProxy() self.aduit_proxy = AduitProxy() def test_aduit_aritcal(self): title = BASE_ARITCAL_TITLE self.home_proxy.to_aduit_page() self.aduit_proxy.test_aduit_aritcal(title) time.sleep(2) assert element_is_exist(driver=self.driver, text=title) def teardown_class(self): time.sleep(2) DriverUtils.quit_mis_driver()
class TestAuditContent: def setup_class(self): # 实例化首页面和登录页面、审核页面的业务类 # self.login_proxy = LoginProxy() self.home_proxy = HomeProxy() self.audit_content_proxy = AuditContentProxy() # self.login_proxy.login("testid", "testpwd123") def teardown_class(self): UtilsDriver.quit_mis_driver() def test_audit_content(self): self.home_proxy.go_audit_page() # 跳转到审核页面 self.audit_content_proxy.audit_content("test-2020-11-30", "待审核", "2020-12-30 12:00:00") assert "test-2020-11-30" in self.audit_content_proxy.confirm_result( "审核通过")
class TestHome: def setup_class(self): self.proxy = HomeProxy() self.ariticle = ArticleAuditProxy() def test_article_audit(self): # 测试数据 title = "ceshi001" status = "待审核" # 进入待审核页面 self.proxy.click_to_audit_page() # 文章审核 self.ariticle.click_to_article_audit(title, status) # 等待文章的审核 time.sleep(2) # 断言 is_exit = self.ariticle.is_pass_audit(title) assert is_exit
class TestLogin: def setup_class(self): # 实例化页面对象的业务层类 self.login_proxy = LoginProxy() self.home_proxy = HomeProxy() def teardown_class(self): UtilsDriver.quit_mis_driver() def test_login_success(self): self.login_proxy.login("testid", "testpwd123") assert "管理员" in self.home_proxy.get_info()
class TestAduit: # 2.定义初始化方法 def setup_class(self): self.driver = DriverUtils.get_mis_driver() # 创建的业务方法所在类的对象 self.home_proxy = HomeProxy() self.aduit_proxy = AduitProxy() # 3.定义测试方法:文案的测试步骤-----业务层中的业务方法 def test_aduit_aritcal(self): # 定义测试数据 ari_title = PUB_ARTICAL_TITLE # 执行测试步骤 self.home_proxy.to_aduit_page() self.aduit_proxy.test_aduit_ari(ari_title) # 断言 assert is_exists_element(self.driver, PUB_ARTICAL_TITLE) # 4.定义销毁方法 def teardown_class(self): time.sleep(2) DriverUtils.quit_mis_driver()
class TestAduit: # 在fixture 打开测试网站 def setup_class(self): self.driver = DriverUtils.get_mis_driver() # 实例化首页的业务层对象 self.home_proxy = HomeProxy() # 实例化审核文章业务层对象 self.aduit_proxy = AduitProxy() # 定义测试方法,在测试方法中会调用已经封装好po文件中业务层中提供的业务方法来实现具体的测试操作 def test_aduit_aritcal(self): # 定义测试数据 title = BASE_ARITCAL_TITLE # 调用业务 self.home_proxy.to_aduit_page() self.aduit_proxy.test_aduit_aritcal(title) # 断言 assert element_is_exist(driver=self.driver, text=title) # fixture中关闭浏览器 def teardown_class(self): DriverUtils.quit_mis_driver()
def setup_class(self): self.driver = DriverUtils.get_mis_driver() # 创建的业务方法所在类的对象 self.home_proxy = HomeProxy() self.aduit_proxy = AduitProxy()
def setup_class(self): self.driver = DriverUtils.get_mis_driver() # 定义创建业务方法所在类的对象 self.home_proxy = HomeProxy() self.audit_proxy = AuditProxy()
def setup_class(self): self.driver = DriverUtils.get_mis_driver() # 实例化首页的业务层对象 self.home_proxy = HomeProxy() # 实例化审核文章业务层对象 self.aduit_proxy = AduitProxy()
def setup_class(self): # 实例化首页面和登录页面、审核页面的业务类 # self.login_proxy = LoginProxy() self.home_proxy = HomeProxy() self.audit_content_proxy = AuditContentProxy()
def setup_class(self): # 实例化页面对象的业务层类 self.login_proxy = LoginProxy() self.home_proxy = HomeProxy()
def setup_class(self): self.proxy = HomeProxy() self.ariticle = ArticleAuditProxy()