当前位置: 首页 > news >正文

万网主机网站建设视频不能上传图片到网站

万网主机网站建设视频,不能上传图片到网站,wordpress首行缩进,如何建立团购网站1.1.登录用户参数化 在测试过程中#xff0c;经常会涉及到需要用不同的用户登录操作#xff0c;可以采用队列的方式#xff0c;对登录的用户进行参数化。如果数据要保证不重复#xff0c;则取完不再放回#xff1b;如可以重复#xff0c;则取出后再返回队列。 def lo…1.1.登录用户参数化   在测试过程中经常会涉及到需要用不同的用户登录操作可以采用队列的方式对登录的用户进行参数化。如果数据要保证不重复则取完不再放回如可以重复则取出后再返回队列。 def login(self): try: user self.user.userqueue.get_nowait() # 取不到数据时直接崩溃走异常处理流程 except queue.Empty: print(没有数据了) exit(0) url ***** headers { Content-Type: application/x-www-form-urlencoded } body { username: user[username], password: ****** } with self.client.post(url, databody, headersheaders, name登录, catch_responseTrue,) as response: self.user.userqueue.put_nowait(user) #数据放回队列 try: res json.loads(response.text) if response.status_code 200 and str(res) user[userid]: response.success() return user[userid] else: response.failure(登录失败) except Exception as e: response.failure(e) class WebUser(HttpUser): tasks [MyTask] wait_time between(0.1, 0.3) host http://******* userdata xlrd.open_workbook(rF:\pycharmproject\locusttest\i8.xls) table userdata.sheet_by_name(Sheet2) # 表格中不同table页的名称 # 获取表格总行数 nrows table.nrows # 实例化队列依次从表格中按行取出数据放进队列 userqueue queue.Queue() for n in range(1, nrows): row_data table.row_values(n) data { username: %s % row_data[0], userid: %s % row_data[1] } userqueue.put_nowait(data) 1.2.使用登录后返回的数据最为后续task的参数   由于on_start 只执行一次不会去执行函数里面的返回因此将登录定义为一个函数再通过on_start调用保证只执行一次同时能够获取到登录后返回的数据。 def on_start(self): self.userid self.login()          def login(self): 登录接口 :return: 登录成功后返回userid用于其他任务的参数 try: user self.user.userqueue.get_nowait() # 取不到数据时直接崩溃走异常处理流程 except queue.Empty: print(没有数据了) exit(0) url ****** headers { Content-Type: application/x-www-form-urlencoded } body { username: user[username], password: ***** } with self.client.post(url, databody, headersheaders, name登录, catch_responseTrue,) as response: self.user.userqueue.put_nowait(user) try: res json.loads(response.text) if response.status_code 200 and str(res) user[userid]: response.success() return user[userid] else: response.failure(登录失败) except Exception as e: response.failure(e) task(3) def addbyi8(self): url ********* body { userid: self.userid } headers { Content-Type: application/x-www-form-urlencoded } with self.client.post(url, databody, headersheaders, catch_responseTrue,) as res: try: resjson json.loads(res.text) if res.status_code 200 and resjson 1: res.success() else: res.failure(添加接口出错%s % resjson) except Exception as e: res.failure(e) 1.3.Post参数的value含有json和随机数   采用random生成随机数拼接到参数value中json可以先定义json然后再转换为字符串的形式传入post参数。  task(1) def changeallbyi8(self): random_number random.randint(1, 1000) url ******** contents { ******: locust发送的 str(random_number), ******: locust图纸的分析 str(random_number) } body { contents: json.dumps(contents) } with self.client.post(url, databody, catch_responseTrue) as res: try: resjson json.loads(res.text) if res.status_code 200 and resjson 1: res.success() else: res.failure(保存接口出错) except Exception as e: res.failure(e) 1.4.Post参数中含有键值对随机取值配对   Typedict字典中创建预设的键值对使用random.choice从字典的键列表中随机选择一个键然后使用这个键从字典中取得对应的值并将其作为请求参数发送。 task(3) def addbyi8(self): typedict { key1: value1, key2: value2 } type random.choice(list(typedict.keys())) url **** body { type: type, operate: typedict[type] } headers { Content-Type: application/x-www-form-urlencoded } with self.client.post(url, databody, headersheaders, catch_responseTrue,) as res: try: resjson json.loads(res.text) if res.status_code 200 and resjson 1: res.success() else: res.failure(添加接口出错) except Exception as e: res.failure(e) 最后感谢每一个认真阅读我文章的人看着粉丝一路的上涨和关注礼尚往来总是要有的虽然不是什么很值钱的东西如果你用得到的话可以直接拿走  软件测试面试文档 我们学习必然是为了找到高薪的工作下面这些面试题是来自阿里、腾讯、字节等一线互联网大厂最新的面试资料并且有字节大佬给出了权威的解答刷完这一套面试资料相信大家都能找到满意的工作。
http://www.hkea.cn/news/14312956/

相关文章:

  • 做淘宝优惠卷网站步骤电子商务有限公司简介
  • 做网站最多的行业网上购物网站建设论文
  • 厦门网站设计培训公司2021热点新闻事件
  • 网站开发主管岗位说明中国建设银行网站会员用户名
  • 电商网站网址如何做自媒体
  • 像wordpress一样的网站温州城乡建设官网
  • 外贸网站建站m仿站小工具 wordpress
  • vs2017做网站第一个做电子商务的网站
  • 网站建设文案有趣网站内容有什么
  • 深圳做网站的公做网站价位
  • 做外贸网站案例wordpress定义页面带html
  • 设计高端网站哪家好查企业用什么软件
  • 检测网站名 注册用python做网站我那些
  • 石家庄网站定制开发怎么给网站做seo优化
  • 写作网站哪个最好上海网站制作公司怎么找
  • 上蔡县住房和城乡建设局网站棒的外贸网站建设
  • 在线做头像网站有哪些北京网站制作设计哪个公司好
  • 大连网站建设哪家好新余百度网站建设
  • 张家港做外贸网站微信免费下载2023新版
  • 广州住房与建设 网站网站宽度设计
  • 用dw做教学网站西安网站建立
  • 做网站 微信开发前景宁波网站制作怎样
  • 管理系统和网站哪个好做linux wordpress 中文字体
  • 国内做彩票网站违法么官网网站怎么做
  • 茂名网站建设方案外包网站建站费用多少钱
  • 昆明汽车建站网站模板制作网页软件有哪些
  • 收企业做网站备案从化市营销型网站建设
  • 淘宝客cms建站教程中国化工建设网站
  • 建设银行公司官网上海排名优化推广工具
  • 建设网站必备条件网站名称可以是域名