Skip to content

Commit

Permalink
优化test_selenium
Browse files Browse the repository at this point in the history
  • Loading branch information
lovesoo committed Oct 12, 2017
1 parent dae615e commit 6117f0d
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions Tests/test_Selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@ class test_login(object):
def __init__(self):
pass

def setUp(self):
self.driver = webdriver.Chrome()
self.driver.implicitly_wait(30)
self.url = "http://mail.126.com"
self.suffix = '@126.com'
self.user = "tafffy"
self.passwd = "lovesoo1314"
self.title = u'网易'
self.tips = u'帐号或密码错误'
@classmethod
def setUpClass(cls):
cls.driver = webdriver.Chrome()
cls.driver.implicitly_wait(30)
cls.url = "http://mail.126.com"
cls.suffix = '@126.com'
cls.user = "tafffy"
cls.passwd = "lovesoo1314"
cls.title = u'网易'
cls.tips = u'帐号或密码错误'

def tearDown(self):
self.driver.quit()
@classmethod
def tearDownClass(cls):
cls.driver.quit()

@staticmethod
@with_setup(setUp, tearDown)
def login(self, user, passwd, tips=''):
# 定义通用login方法
print 'Login user: %s ,passwd: %s' % (user, passwd)
Expand Down Expand Up @@ -57,6 +58,10 @@ def login(self, user, passwd, tips=''):
else:
# 登陆成功校验UserID
login_userID = login_page.show_userid()
# 点击退出
login_page.click_logout()
time.sleep(1)

print 'Login UserID: %s' % login_userID
assert user + self.suffix == login_userID, 'Check UserID Failed!'

Expand Down

0 comments on commit 6117f0d

Please sign in to comment.