摘要: from urllib.parse import urlencode, quote, unquote # urlencode方法参数是字典 body = { "content": "悠悠", "charsetSelect": "utf-8", "en": "UrlEncode编码" } print( 阅读全文
posted @ 2019-09-26 18:51 千年妖狐 阅读(329) 评论(0) 推荐(0) 编辑
摘要: r = s.get(loginurl, verify=False) dom = etree.HTML(r.content.decode("utf-8")) try: result["lt"] = dom.xpath('//input[@name="lt"]')[0].get("value") res 阅读全文
posted @ 2019-09-26 18:49 千年妖狐 阅读(550) 评论(0) 推荐(0) 编辑
摘要: # python3字符串换行,在右边加个反斜杠 body = '<?xml version="1.0" encoding = "UTF-8"?>' \ '<COM>' \ '<REQ name="上海-悠悠">' \ '<USER_ID>yoyoketang</USER_ID>' \ '<COMMO 阅读全文
posted @ 2019-09-26 18:45 千年妖狐 阅读(1044) 评论(0) 推荐(0) 编辑
摘要: total_seconds 总时长,单位秒 days 以天为单位 microseconds (>= 0 and less than 1 second) 获取微秒部分,大于0小于1秒 seconds Number of seconds (>= 0 and less than 1 day) 秒,大于0小 阅读全文
posted @ 2019-09-26 18:40 千年妖狐 阅读(251) 评论(0) 推荐(0) 编辑
摘要: '''判断title是否是一致,返回布尔值'''WebDriverWait(driver,10,0.1).until(EC.title_is("title_text"))'''判断title是否与包含预期值,返回布尔值'''WebDriverWait(driver,10,0.1).until(EC. 阅读全文
posted @ 2019-09-26 18:35 千年妖狐 阅读(407) 评论(0) 推荐(0) 编辑
摘要: pip install requests-toolbelt from requests_toolbelt import MultipartEncoder import requests m = MultipartEncoder( fields={'field0': 'value', 'field1' 阅读全文
posted @ 2019-09-26 18:27 千年妖狐 阅读(741) 评论(0) 推荐(0) 编辑
摘要: # 测试数据testData =[ ] @ddt.ddtclass Bolg(unittest.TestCase): @ddt.data(*testData) def test_login(self, data): u'''登录案例参考''' print ("当前测试数据%s"%data) # 调用 阅读全文
posted @ 2019-09-26 18:12 千年妖狐 阅读(174) 评论(0) 推荐(0) 编辑
摘要: unittest常用的断言方法 1.assertEqual(self, first, second, msg=None) --判断两个参数相等:first == second 2.assertNotEqual(self, first, second, msg=None) --判断两个参数不相等:fi 阅读全文
posted @ 2019-09-26 17:58 千年妖狐 阅读(1382) 评论(0) 推荐(0) 编辑
摘要: @classmethod def setUpClass(cls): print "start!" @classmethod def tearDownClass(cls): time.sleep(1) print "end!" 阅读全文
posted @ 2019-09-26 17:57 千年妖狐 阅读(477) 评论(0) 推荐(0) 编辑
摘要: # html报告文件路径 report_abspath = os.path.join(report_path, "result.html") fp = open(report_abspath, "wb") runner = HTMLTestRunner.HTMLTestRunner(stream=f 阅读全文
posted @ 2019-09-26 17:55 千年妖狐 阅读(346) 评论(0) 推荐(0) 编辑
摘要: # 用法 globals()["a"] = "用例a的返回结果" # 用例b引用 b = globals()["a"] print(b) import repostid = re.findall(r"postid=(.+?)&", r2.url)print postid # 这里是list# 提取为 阅读全文
posted @ 2019-09-26 17:54 千年妖狐 阅读(191) 评论(0) 推荐(0) 编辑
摘要: diascover加载测试用例 1.discover方法里面有三个参数: -case_dir:这个是待执行用例的目录。 -pattern:这个是匹配脚本名称的规则,test*.py意思是匹配test开头的所有脚本。 -top_level_dir:这个是顶层目录的名称,一般默认等于None就行了。 2 阅读全文
posted @ 2019-09-26 17:46 千年妖狐 阅读(204) 评论(0) 推荐(0) 编辑
摘要: def test_01(self): '''前面输入账号密码,让正确运行到assert这一步,断言故意设置为False不成功''' try: self.driver.find_element_by_id("input1").send_keys(u"啊啊啊") self.driver.find_ele 阅读全文
posted @ 2019-09-26 17:39 千年妖狐 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 注册地址:https://github.com/ 创建一个repository name,输入框随便取一个名字(不要用中文!!!) git是本地客户端管理代码的一个工具,下载地址:https://git-scm.com/download/win 安装完成后,本地随便建个文件夹,如github,在文件 阅读全文
posted @ 2019-09-26 17:05 千年妖狐 阅读(297) 评论(0) 推荐(0) 编辑
摘要: github地址https://github.com/openatx/weditor python -m weditor --shortcut adb devices 在页面上输入手机设备号,点Connet按钮,看到出现一个小草的图标,就是连接成功了 python -m weditor --shor 阅读全文
posted @ 2019-09-26 16:56 千年妖狐 阅读(1571) 评论(0) 推荐(0) 编辑
摘要: 安装:yum install -y httpd-tools 验证:ab -V ab -help:-n requests 要执行请求总数,默认会执行一个请求 -c concurrency 一次执行多个请求的数量,也就是并发数 -t timelimit 用于基准测试的最大秒数,使用它在固定的总时间内对服 阅读全文
posted @ 2019-09-26 16:41 千年妖狐 阅读(365) 评论(0) 推荐(0) 编辑