摘要:
python自动化web测试文档包含的内容: 1.web自动化说明与框架 2. web自动化测试例子 3.环境的搭建(附录) 近期,由于对需要对迪备产品进行web测试,上网找了些关于python进行自动化测试的资料,发现进行Web测试,可以通过Webdriver去模拟用户的操作,当前比较出色就是splinter+selenuim,基本上支持IE,fixfox和chrome浏览器的基本操作。 有了第三方模拟浏览器工具的帮助,然后就要想想产品的测试框架了,因为我们的产品基本上进行的是功能测试,而python自己自带的unitt... 阅读全文
摘要:
#-*-coding:utf-8-*-from __future__ import with_statementimport osimport unittestimport timefrom splinter import Browserfrom random import randintclass DbackupTestCase(unittest.TestCase): @classmethod def setUpClass(cls): cls.browser = Browser('firefox') @classmethod def setDownCla... 阅读全文
摘要:
#!/usr/bin/env python请参考http协议:import socketimport reimport sysdef check_webserver(address, port, resource): #build up HTTP request string if not resource.startswith('/'): resource = '/' + resource request_string = "GET %s HTTP/1.1\r\nHost: %s\r\n\r\n" %(resource,address) p 阅读全文
摘要:
具体文档参见:http://docs.python.org/library/xml.etree.elementtree.html例子:#-*-coding:utf-8-*-from xml.etree import ElementTree as ETfile = ET.parse('ftp.xml')ftps = file.findall('/ftp')for ftp in ftps: print ftp.attrib print ftp.get('name') print ftp.get('ip') print ftp.get( 阅读全文
摘要:
#!/usr/bin/env pythonimport ftplibimport osclass FTPSync(object): def __init__(self,host,username, password, ftp_base_dir, local_base_dir, delete=False): self.host = host self.username = username self.password = password self.ftp_base_dir = f... 阅读全文
摘要:
Some _mysql examplesOkay, so you want to use _mysql anyway. Here are some examples.The simplest possible database connection is:import _mysqldb=_mysql.connect()This creates a connection to the MySQL server running on the local machine using the standard UNIX socket (or named pipe on Windows), your l 阅读全文