def test_login1(self): """用户名为空""" case_name = '用户为空' log1.info("执行测试用例:%s" % case_name) login = LoginPage(self.driver) login.login(' ', '12324') error_text = login.get_login_error() try: self.assertEqual(error_text, 'Incorrect username or password.') log1.info("测试用例执行成功:%s" % case_name + '\n') except AssertionError: log1.error("测试用例执行失败:%s" % case_name + '\n') raise
def test_login3(self): """密码不正确""" case_name = '密码不正确' log1.info("执行测试用例:%s" % case_name) login = LoginPage(self.driver) login.login('xuhaixiang1993', ' 12314') error_text = login.get_login_error() try: self.assertEqual(error_text, 'Incorrect username or password.') log1.info("测试用例执行成功:%s" % case_name + '\n') except AssertionError: log1.error("测试用例执行失败:%s" % case_name + '\n') raise
def test_login2(self): """密码为空""" case_name = '密码为空' log1.info("执行测试用例:%s" % case_name) login = LoginPage(self.driver) login.login('LJDY1077', '') error_text = login.get_login_error() try: self.assertEqual(error_text, '密码不能为空。') log1.info("测试用例执行成功:%s" % case_name + '\n') except AssertionError: log1.error("测试用例执行失败:%s" % case_name + '\n') raise