【发布时间】:2016-07-13 12:29:39
【问题描述】:
该测试应该通过调用TALogin.test() 超级方法来登录用户,该方法会传递凭据(URL、用户名/密码等),然后将用户注销。但是,当我运行它时,它会运行 TALogin 部分,然后关闭并再次运行它,但会执行注销部分。
所以,我得到以下信息:
Ran 2 tests in 65.990s
OK
我只希望它运行一次;登录,然后注销。
这是我的代码:
from BaseTestCase import BaseTestCase
from pages.BasePage import BasePage
from login.TALogin_Test import TALogin
import nose
class TALogout_Test(TALogin):
def setUp(self):
super(TALogout_Test, self).setUp()
def test(self):
super(TALogout_Test, self).test()
base_obj = BasePage(self.driver)
base_obj.do_logout()
def tearDown(self):
super(TALogout_Test, self).tearDown()
if __name__ == "__main__":
nose.run(defaultTest=__name__)
【问题讨论】:
标签: python-2.7 nose python-unittest