class TestLogin(): # 实例化 def setup_class(self): self.login = PageLogin(get_driver()) # 关闭app def teardown_class(self): self.login.driver.quit() time.sleep(3) @pytest.mark.parametrize("username,password", [("18309150000", "123456")]) # 输入用户名.密码.点击登录 def test_login(self, username, password): self.login.page_click_me() # 点击我的 self.login.page_click_login() # 点击登录按钮 self.login.page_click_phone() # 点击手机号登录 self.login.page_input_user(username) # 输入手机号 self.login.page_input_pwd(password) # 输入密码 self.login.page_click_btn() # 点击按钮 def test01(self): print("kkkk") def test01(self): print("jjjj")
class TestLogin(): @allure.step("实例化") def setup_class(self): self.test = PageLogin(get_driver()) @allure.step("关闭") def teardown_class(self): self.test.driver.quit() @pytest.mark.parametrize("username,pwd", get_data()) @allure.step("登录步骤") @pytest.allure.severity(pytest.allure.severity_level.CRITICAL) def testlogin(self, username, pwd): allure.attach("描述:", "输入用户名") self.test.page_input_username(username) allure.attach("描述:", "输入密码") self.test.page_input_pwd(pwd) allure.attach("描述:", "点击登录") self.test.page_click_btn() assert 0