unittest 单元测试框架 web测试
2017-11-02 15:02
507 查看
1. 使用unittest单元测试框架
# coding:utf-8 # coding:cp936 from selenium import webdriver from time import sleep import unittest class my_test(unittest.TestCase): # my_test类继承unittest框架的TestCase类 def setUp(self): # setUp 设置初始化 self.broswer = webdriver.Chrome() self.broswer.maximize_window() self.broswer.implicitly_wait(10) self.url1 = "http://192.168.129.10" def test_baidu(self): # 测试脚本 broswer = self.broswer broswer.get(self.url1) broswer.find_element_by_id("loguserName").clear() broswer.find_element_by_id("loguserName").send_keys("admin") broswer.find_element_by_id("loguserPwd").clear() broswer.find_element_by_id("loguserPwd").send_keys("12345678") broswer.find_element_by_id("btnLogin").click() sleep(2) def tearDown(self): # tearDown 恢复 self.broswer.quit() if __name__ == "__main__": unittest.main()
相关文章推荐
- unittest单元测试框架总结
- 引用单元测试模块unittest框架(四)
- Python单元测试框架unittest简介
- python单元测试框架unittest简介
- 引用单元测试模块unittest框架(四)
- python的unittest单元测试框架改装传参
- Python单元测试框架unittest测试过程简介
- unittest单元测试框架总结
- Appium移动端自动化测试之整合unittest单元测试框架(十)
- Python:unittest单元测试框架(一)
- Python单元测试框架unittest使用方法讲解
- 引用单元测试模块unittest框架(三)
- 22.七-通过unittest单元测试框架编写单元测试用例
- Python 的单元测试框架Unittest之一(TestResult类分析)
- Python单元测试框架 — unittest
- unittest 单元测试框架断言方法
- Python+Selenium框架设计篇之2-简单介绍unittest单元测试框架
- unittest单元测试框架总结
- Python单元测试框架unittest简介
- python的unittest单元测试框架断言整理汇总