UI自动化web端框架test_webCase.py代码

import unittest
from lib.page.web.page import Page


class WebCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.page = Page()
cls.page.get()

def test_a_zbox_login(self):
"""登录"""
self.page.username()
self.page.password()
self.page.submit()
self.assertTrue(self.page.check_login(self.test_a_zbox_login.__name__)) # 把当前函数的名字传进去了

def test_b_create_bug(self):
"""创建bug"""
self.page.bug_tag()
self.page.create_bug()
self.page.module()
self.page.system()
self.page.browser()
self.page.build()
self.page.assign()
self.page.end_date()
self.page.title()
self.page.repeat_step()
self.page.save()
self.assertTrue(self.page.check_create_bug(self.test_b_create_bug.__name__))

@classmethod
def tearDownClass(cls):
import time
time.sleep(2)
cls.page.quit()


if __name__ == '__main__':
unittest.main()
原文地址:https://www.cnblogs.com/laosun0204/p/9268198.html