setUpClass tearDownClass使用

2017-04-25  本文已影响512人  望月成三人
class TestInterfaceCase(unittest.TestCase):
    def __init__(self, methodName='runTest'):
        super(TestInterfaceCase, self).__init__(methodName)
    @classmethod
    def setUpClass(cls, casename):
        cls.driver = selenium_testcase()
        cls.cb = webCase.WebCaseBase(driver=cls.driver, casename=casename)
      ...

  @classmethod
   def tearDownClass(cls):
           pass
class testRightLogin(TestInterfaceCase):
    @classmethod
    def setUpClass(cls):
        super(testRightLogin, cls).setUpClass(casename="testRightLogin")
    @classmethod
    def tearDownClass(cls):
        cls.driver.quit()

    def test_login(cls):
        cls.cb.execCase(PATH("../yaml/rightLogin.yaml"))

    def test_setting(cls):
        cls.cb.execCase(PATH("../yaml/setting.yaml"))
上一篇下一篇

猜你喜欢

热点阅读