Web Automation Test-po design Pattern (iii)

Source: Internet
Author: User

Test_case directory structure of the use case directory you want to execute
ui_auto_test    --src        --test_case            --__init.py            --test_login_case        --pages            --__init.py            --base_page.py            --login_page.py
test_login_case.py
# conding:utf8import unittestimport os, sys#获取项目顶级文件夹绝对路径src_path = os.path.split(os.path.split(__file__)[0])[0]sys.path.insert(0, src_path)from pages.login_page import LoginActionfrom selenium import webdriverclass LoginCase(unittest.TestCase):    def setUp(self):        self.driver = webdriver.Chrome()    def test_login_success(self):        login_page = LoginAction(self.driver, path=‘cloud_logins/login‘)        username = ‘xxxxxx‘        password = ‘xxxxxx‘        home_page = login_page.login_action(username, password)        text = home_page.get_undo_word_text()        print(text)        self.assertEqual(‘我的待办‘, text)    def tearDown(self):        self.driver.quit()if __name__ == ‘__main__‘:    unittest.main()

Web Automation Test-po design Pattern (iii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.