
自动化测试
笑笑曦
这个作者很懒,什么都没留下…
展开
-
xmind2testcase使用与二次开发
xmind2testcase使用与简单重构原创 2023-10-31 12:04:47 · 784 阅读 · 0 评论 -
linux环境搭建jmeter、ant、git、Jenkins、jdk、Tomcat
进入bin目录后 ./startup.sh 运行(若报错: -bash: ./startup.sh: Permission denied 说明权限不够,如果你是root账号,直接执行指令: chmod u+x *.sh 赋予权限即可)1、在 jmeter 的 /opt/apache-jmeter-5.4.1\Extras 目录下找到 ant-jmeter-1.1.1.jar 文件,将它复制到 ant 的 \lib 目录下。4、javax.mail.jar包,然后放在 ant 的 \lib 目录下。原创 2023-04-20 18:18:32 · 689 阅读 · 0 评论 -
jmeter并发量按比例分配
设置10个并发量,jmeter设置比例使用随机变量和if控制器1.设置10个线程数:2.设置随机变量,变量最小值1,最大值10(并发线程数),变量名(设置函数时)3.函数对话__jexl3设置,如下图(randNo{randNo}%2==0表示取除以2为0的随机值;randNo{__jexl3(${randNo}>1 && ${randNo}%2!=0,)}, &&表示和,||表示或)4.if空值器引用生成的函数表达式...原创 2021-04-28 10:24:43 · 1838 阅读 · 0 评论 -
python连接redis集群
python连接redis集群,安装redis-py-cluster模块pip installredis-py-clusterfrom rediscluster import RedisClusterdef redis_list(): ''' 集群处理 :return: ''' REDIS_NODES = [] redis_str = "99.99.3.12:7006,99.99.3.12:7004,99.99.3.12:7002,99.99..原创 2021-03-19 15:38:42 · 2059 阅读 · 0 评论 -
jenkins设置(集成python、pytest、jenkins、git、allure、maven)
1、Global Tool Configuration(全局工具配置)JDK:git:maven:Allure Commandline:2、项目配置源码管理:构建触发器:构建:构建后操作:原创 2021-01-08 10:26:28 · 261 阅读 · 0 评论 -
jmeter脚本添加断言、预处理(脚本处理数据参数化)
前言:1.通过脚本添加断言(命令生成html报告,会记录日志),与提取的响应数据进行对比 正则表达提取数据 JSR223断言:python脚本断言(需下载jython 2.7,将插件放在lib文件夹下) JSR223断言:groovy脚本断言2.预处理程序(通过脚本处理数据,这里说明的是处理数据,使其可以参数化并循环调用) 计数器 JSR223预处理程序:python脚本处理(需下载jython 2.7,将插件放在lib文件夹下) JSR223预处理程序:...原创 2020-07-17 16:41:02 · 2514 阅读 · 0 评论 -
操作mysql(获取列名与值)--不同服务器
__description__='Finding data in different servers'import pymysqlimport jsonimport decimalimport datetimedb1=pymysql.connect(host="服务器地址",port=3306,user='用户名',password='密码',db='数据库名称',charset='...原创 2018-05-24 17:53:23 · 1322 阅读 · 0 评论 -
uiautomator2 测试
import uiautomator2 as ui2import osimport timeimport unittestimport HTMLTestRunnerCNclass HLJ_Shopping_Menu(unittest.TestCase): '''关注''' def setUp(self): # self.driver=ui2.conne...原创 2018-08-03 17:27:45 · 620 阅读 · 0 评论 -
app应用启动测试,并将数据写入csv文件
import osimport subprocessimport codecsimport timeimport refrom decimal import *import csvclass Start_APP(object): all_info=[] def get_devicesinfo(self): devices_name=subproce...原创 2018-08-23 11:23:21 · 457 阅读 · 0 评论 -
aiohttp异步爬取数据发送请求--小试
import aiohttpimport asyncioimport timefrom bs4 import BeautifulSoupimport reimport requests#限制启动线程数sema=asyncio.Semaphore(100)#判断链接是否正常打开async def get_url(url): # conn=aiohttp.TCPConn...原创 2018-11-29 09:51:28 · 741 阅读 · 0 评论 -
接口测试--requests.session()
import requestsimport unittestimport jsonclass scm_api(unittest.TestCase): def test_get_paramete(self): url='http://dev.wechat.tianhong.cn:9090/api/login-adapter/user/login' d...原创 2018-12-14 10:36:45 · 952 阅读 · 0 评论 -
HTMLTestReportCN比较好看的html测试报告
# coding=utf-8"""A TestRunner for use with the Python unit testing framework. Itgenerates a HTML report to show the result at a glance.The simplest way to use this is to invoke its main method. E...转载 2018-12-27 15:20:56 · 4918 阅读 · 0 评论 -
接口返回数据与数据数据的对比、数据表之间的拆分重组对比
import pymysqlimport datetimeimport jsonimport decimalimport requestsimport warningsimport time"""超市供应链数据测试:1、product表和supplier表拆分重组与supply_introduce表对比 2、接口返回数据和supply_int...原创 2018-12-18 11:39:58 · 1596 阅读 · 0 评论 -
接口自动化测试(日期格式与毫秒级之间的转换、日期时间增减、数字转换字符)
import requestsimport jsonimport warningsimport timeimport unittestfrom datetime import datetimefrom datetime import timedeltaimport HTMLTestReportCN"""后台操作修改商品,对比前端商品数据变化是否一致(以XXXX作为测试)""...原创 2019-01-31 11:07:37 · 1026 阅读 · 0 评论 -
使用selenium webdriver从隐藏元素中获取文本
from selenium import webdriverDEMO_PAGE = '''data:text/html, <p>Demo page for how to get text from hidden elements using Selenium WebDriver.</p> <div id='demo-div'>Demo div...转载 2018-04-28 09:40:15 · 1432 阅读 · 0 评论 -
HTMLTestReportEN--python2生成HTML测试报告(英文测试报告)
#coding=utf-8"""A TestRunner for use with the Python unit testing framework. Itgenerates a HTML report to show the result at a glance.The simplest way to use this is to invoke its main method. E....转载 2018-04-27 15:58:08 · 793 阅读 · 0 评论 -
接口自动化实例
import requestsimport jsonimport sysimport csvimport codecsimport _md5 #加密模块reload(sys)sys.setdefaultencoding('UTF-8')#web接口测试url = 'http://web.fangdongliqi.com/'headers={ 'User-Agent':...原创 2018-02-25 02:27:10 · 2151 阅读 · 0 评论 -
APP UI层自动化测试--使用HTMLtestRunner生成报告
import unittestimport HTMLTestRunnerimport timefrom appium import webdriverclass fangdongliqi(unittest.TestCase): u'''测试我模块''' def setUp(self): desired_caps={} desired_cap...原创 2018-02-25 22:16:04 · 534 阅读 · 0 评论 -
获取手机屏幕尺寸
import timefrom appium import webdriverimport pytestimport datetimeclass Testfangdongliqi: u'测试应付账' def setup_class(self): desired_caps = {} desired_caps['platformName'] =...原创 2018-02-25 22:11:10 · 781 阅读 · 0 评论 -
APP UI层自动化测试--基于appium
import pytestimport timefrom appium import webdriverclass Testfangdongliqi: u'测试登录' def setup_class(self): desired_caps = {} desired_caps['platformName'] = 'Android' ...原创 2018-02-25 22:03:58 · 637 阅读 · 0 评论 -
web自动化测试
import HTMLTestRunnerfrom selenium import webdriverimport unittestimport timefrom parameterized import parameterizedclass test_web(unittest.TestCase): @classmethod def setUpClass(cls): ...转载 2018-02-25 02:07:16 · 239 阅读 · 0 评论 -
Python调用adb shell
import osimport subprocessimport codecs#使用popendef execmd(cmd): f=os.popen(cmd) text=f.read() f.close() return text if __name__=='__main__': cmd="ipconfig/all" execmd(c...转载 2018-02-24 23:29:12 · 4459 阅读 · 0 评论 -
HTMLTestRunner模块--生成自动化测试报告
#-*- coding: utf-8 -*-#!/usr/bin/python"""A TestRunner for use with the Python unit testing common. Itgenerates a HTML report to show the result at a glance.The simplest way to use this is to i...转载 2018-02-28 20:21:28 · 688 阅读 · 0 评论 -
接口自动化测试
import unittestimport requestsimport jsonimport HTMLTestRunnerfrom parameterized import parameterizedclass apitest(unittest.TestCase): def setUp(self): url='www.xxxx.com' dat...原创 2018-03-07 20:27:11 · 299 阅读 · 0 评论 -
HTMLTestReportCN--python2生成HTML测试报告(中文测试报告)
#coding=utf-8"""A TestRunner for use with the Python unit testing framework. Itgenerates a HTML report to show the result at a glance.The simplest way to use this is to invoke its main method. E....转载 2018-04-27 15:57:15 · 2429 阅读 · 0 评论 -
HTMLTestReportEN--python3生成HTML测试报告(英文测试报告)
#coding=utf-8"""A TestRunner for use with the Python unit testing framework. Itgenerates a HTML report to show the result at a glance.The simplest way to use this is to invoke its main method. E....转载 2018-04-27 15:54:59 · 928 阅读 · 0 评论 -
HTMLTestReportCN--python3生成HTML测试报告(中文测试报告)
#coding=utf-8"""A TestRunner for use with the Python unit testing framework. Itgenerates a HTML report to show the result at a glance.The simplest way to use this is to invoke its main method. E....转载 2018-04-27 15:52:27 · 7295 阅读 · 0 评论 -
元素高亮
def ui_highlight(self,types,element): js='' try: if 'id'==types: js="var q=document.getElementById('"+element+"');q.style.border='3px solid red';" ...转载 2018-04-27 15:08:27 · 278 阅读 · 0 评论 -
web自动化测试之界面滑动
方法一)使用js脚本直接操作,方法如下:js="var q=document.getElementById('id').scrollTop=10000"driver.execute_script(js) 或:js="var q=document.documentElement.scrollTop=10000"driver.execute_script(js) 这里的id为滚动条...转载 2018-04-27 15:07:22 · 4363 阅读 · 0 评论 -
关于selenium启动Chrome时,加载Chrome配置的方法
下面是关于加载Chrome配置的方法:一、加载所有Chrome配置 用Chrome地址栏输入chrome://version/,查看自己的“个人资料路径”,然后在浏览器启动时,调用这个配置文件,代码如下: #coding=utf-8 from selenium import webdriver option = webdriver.ChromeOptions() option...转载 2018-04-27 13:51:58 · 5229 阅读 · 0 评论 -
HTMLTestRunnerEN.py--同时支持python2,python3(英文版)
#coding=utf-8"""A TestRunner for use with the Python unit testing framework. Itgenerates a HTML report to show the result at a glance.The simplest way to use this is to invoke its main method. E.g...转载 2018-05-01 23:32:04 · 392 阅读 · 0 评论 -
HTMLTestRunnerCN.py--同时支持python2,python3(中文版)
#coding=utf-8"""A TestRunner for use with the Python unit testing framework. Itgenerates a HTML report to show the result at a glance.The simplest way to use this is to invoke its main method. E.g...转载 2018-05-01 23:30:38 · 4193 阅读 · 0 评论 -
加载运行多个自动化测试脚本
import unittestimport reimport HTMLTestRunner#加载测试文件(针对方法一)import testF1 #testF1表示testF1.py文件import testF2#方法一:#构造测试集suit=unittest.TestSuite()suit.addTest(testF1.fangdongliqi("test_case1"))...转载 2018-03-07 17:40:11 · 793 阅读 · 0 评论