selenium python login test with valid, invalid test data?
how can implement the following case in python ?
i just cant figure out how to solve this problem
CASE – 1 [ Enter Correct user Name and Password ]
CASE – 2 [ Both Email and Password Fields are blank.]
CASE – 3 [ Email field is filled and Password field is blank. ]
CASE – 4 [ Email field is blank and Password field is filled ]
CASE – 5 [ Email and Password are entered wrong ]
CASE – 6 [ Email is wrong and Password is correct ]
CASE – 7 [ Email is correct and Password is wrong ]
回答:
import unittestfrom selenium import webdriver
class TestLogin(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome()
self.url = 'http://xxx'
def test_case_1():
"""Test Correct user Name and Password"""
# code for login
# assert page title
pass
def test_case_2():
"""Test Email and Password Fields are blank"""
pass
...
def tearDown(self):
self.driver.quit()
if __name__ == "__main__":
unittest.main()
以上是 selenium python login test with valid, invalid test data? 的全部内容, 来源链接: utcz.com/a/156896.html